From 6e1102215aa196b3ddd9c73cd12267630e17e7da Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 15 May 2024 16:52:20 +0200 Subject: Thrift: Set read timeout of 2 minutes --- .../org/openslx/imagemaster/thrift/server/BinaryListener.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java b/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java index 7c20202..bd11d68 100644 --- a/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java +++ b/src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java @@ -27,6 +27,12 @@ public class BinaryListener implements Runnable { private static final int MAX_MSG_LEN = 30 * 1000 * 1000; + /** + * How long a client connection can be idle before we close it to free up resources. + * Keep this a bit higher than the timeout client-side... + */ + private static final int CLIENT_TIMEOUT_MS = 120_000; + private final MasterServer.Processor processor = new MasterServer.Processor( new MasterServerHandler() ); final TProtocolFactory protFactory = new TBinaryProtocolSafe.Factory( true, true ); @@ -70,7 +76,7 @@ public class BinaryListener implements Runnable params.setKeyStore( Globals.getSslKeystoreFile(), Globals.getSslKeystorePassword() ); TServerTransport serverTransport; try { - serverTransport = TSSLTransportFactory.getServerSocket( port, 0, null, params ); + serverTransport = TSSLTransportFactory.getServerSocket( port, CLIENT_TIMEOUT_MS, null, params ); } catch ( TTransportException e ) { log.fatal( "Could not listen on port " + port ); throw e; -- cgit v1.2.3-55-g7522