Skip to content
Snippets Groups Projects
Unverified Commit 18dd7d7a authored by akwizgran's avatar akwizgran
Browse files

Use socket timeout to limit number of open sockets.

parent 5f86dd02
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ public class DevReportServer { ...@@ -18,6 +18,7 @@ public class DevReportServer {
private static final int MAX_REPORT_LENGTH = 1024 * 1024; private static final int MAX_REPORT_LENGTH = 1024 * 1024;
private static final int MIN_REQUEST_INTERVAL_MS = 60 * 1000; // 1 minute private static final int MIN_REQUEST_INTERVAL_MS = 60 * 1000; // 1 minute
private static final int MAX_TOKENS = 1000; private static final int MAX_TOKENS = 1000;
private static final int SOCKET_TIMEOUT_MS = 60 * 1000; // 1 minute
private final InetSocketAddress listenAddress; private final InetSocketAddress listenAddress;
private final File reportDir; private final File reportDir;
...@@ -105,6 +106,7 @@ public class DevReportServer { ...@@ -105,6 +106,7 @@ public class DevReportServer {
File reportFile = null; File reportFile = null;
OutputStream out = null; OutputStream out = null;
try { try {
socket.setSoTimeout(SOCKET_TIMEOUT_MS);
in = socket.getInputStream(); in = socket.getInputStream();
reportDir.mkdirs(); reportDir.mkdirs();
reportFile = File.createTempFile(FILE_PREFIX, FILE_SUFFIX, reportFile = File.createTempFile(FILE_PREFIX, FILE_SUFFIX,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment