Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified gradlew
100644 → 100755
Empty file.
29 changes: 29 additions & 0 deletions proxy/src/main/java/ac/eva/hyproxy/io/HytaleConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,35 @@ public void channelInactive(ChannelHandlerContext ctx) {
}
}

@Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) {
QuicStreamChannel streamChannel = (QuicStreamChannel) ctx.channel();
NetworkChannel networkChannel = this.channelsByStreamId.getOrDefault(streamChannel.streamId(), NetworkChannel.DEFAULT);

QuicStreamChannel peerStream = this.getPeerStream(networkChannel);
if (peerStream != null && peerStream.isActive()) {
peerStream.config().setAutoRead(streamChannel.isWritable());
}

ctx.fireChannelWritabilityChanged();
}

private @Nullable QuicStreamChannel getPeerStream(NetworkChannel networkChannel) {
if (this.player == null) {
return null;
}

HytaleConnection peer = this.player.getInboundConnection() == this
? this.player.getOutboundConnection()
: this.player.getInboundConnection();

if (peer == null) {
return null;
}

return peer.streams.get(networkChannel);
}

public String getIdentifier() {
if (this.hasPlayer()) {
return player.getIdentifier();
Expand Down