mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-11-30 00:56:50 +00:00
Fix large gRPC response truncation
This commit is contained in:
1 parent
9bbd04afaa
commit
3f7012dba4
1 file changed
+15
-1
+15
-1
@@ -57,12 +57,26 @@ public class H2FrameProxyHandler extends ChannelInboundHandlerAdapter {
|
||||
"proxy", proxyNameTag,
|
||||
BACKEND_TAG_NAME, backendNameTag)
|
||||
.increment();
|
||||
ctx.channel().config().setAutoRead(peerStream.isWritable());
|
||||
setAutoRead(ctx.channel(), peerStream.isWritable());
|
||||
super.channelWritabilityChanged(peerCtx);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Set auto-read on `channel`, ensuring the call happens on the channel’s event loop.
|
||||
///
|
||||
/// [io.netty.channel.ChannelConfig#setAutoRead] implementations appear to handle calls from outside the event
|
||||
/// loop, but without conservatively ensuring the call happens on the event loop, proxied responses are sometimes
|
||||
/// truncated.
|
||||
private static void setAutoRead(final Channel channel, final boolean autoRead) {
|
||||
if (!channel.eventLoop().inEventLoop()) {
|
||||
channel.eventLoop().execute(() -> setAutoRead(channel, autoRead));
|
||||
return;
|
||||
}
|
||||
|
||||
channel.config().setAutoRead(autoRead);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead(final ChannelHandlerContext ctx, final Object msg) {
|
||||
logger.trace("Received frame {}", msg);
|
||||
|
||||
Reference in new issue
Block a user