From 18dd7d7aa98a16b7573321e1ea7ec844146944d8 Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Mon, 22 Aug 2016 18:11:04 +0100
Subject: [PATCH] Use socket timeout to limit number of open sockets.

---
 briar-core/src/org/briarproject/reporting/DevReportServer.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/briar-core/src/org/briarproject/reporting/DevReportServer.java b/briar-core/src/org/briarproject/reporting/DevReportServer.java
index 897756eeb3..e8e0ffa97f 100644
--- a/briar-core/src/org/briarproject/reporting/DevReportServer.java
+++ b/briar-core/src/org/briarproject/reporting/DevReportServer.java
@@ -18,6 +18,7 @@ public class DevReportServer {
 	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 MAX_TOKENS = 1000;
+	private static final int SOCKET_TIMEOUT_MS = 60 * 1000; // 1 minute
 
 	private final InetSocketAddress listenAddress;
 	private final File reportDir;
@@ -105,6 +106,7 @@ public class DevReportServer {
 			File reportFile = null;
 			OutputStream out = null;
 			try {
+				socket.setSoTimeout(SOCKET_TIMEOUT_MS);
 				in = socket.getInputStream();
 				reportDir.mkdirs();
 				reportFile = File.createTempFile(FILE_PREFIX, FILE_SUFFIX,
-- 
GitLab