diff options
author | Simon Rettberg | 2024-05-15 16:52:20 +0200 |
---|---|---|
committer | Simon Rettberg | 2024-05-15 16:52:20 +0200 |
commit | 6e1102215aa196b3ddd9c73cd12267630e17e7da (patch) | |
tree | 90384159c843a9c5d2310ea9492d0f106dce1e1f | |
parent | RPC: Add option to set session timeout on creation (diff) | |
download | masterserver-6e1102215aa196b3ddd9c73cd12267630e17e7da.tar.gz masterserver-6e1102215aa196b3ddd9c73cd12267630e17e7da.tar.xz masterserver-6e1102215aa196b3ddd9c73cd12267630e17e7da.zip |
Thrift: Set read timeout of 2 minutes
-rw-r--r-- | src/main/java/org/openslx/imagemaster/thrift/server/BinaryListener.java | 8 |
1 files changed, 7 insertions, 1 deletions
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<MasterServerHandler> processor = new MasterServer.Processor<MasterServerHandler>( 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; |