From 6e06d326e3cc15a85ff898f7281cd2e3a8a799c1 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Sat, 27 Jun 2015 20:31:56 +0000
Subject: [PATCH] Use ReadLine for SAMHandlerFactory

---
 apps/sam/java/src/net/i2p/sam/SAMHandlerFactory.java | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/apps/sam/java/src/net/i2p/sam/SAMHandlerFactory.java b/apps/sam/java/src/net/i2p/sam/SAMHandlerFactory.java
index fbe1e905a3..4bb374f8dd 100644
--- a/apps/sam/java/src/net/i2p/sam/SAMHandlerFactory.java
+++ b/apps/sam/java/src/net/i2p/sam/SAMHandlerFactory.java
@@ -46,14 +46,11 @@ class SAMHandlerFactory {
 
         try {
             Socket sock = s.socket();
-            sock.setSoTimeout(HELLO_TIMEOUT);
             sock.setKeepAlive(true);
-            String line = DataHelper.readLine(sock.getInputStream());
+            StringBuilder buf = new StringBuilder(128);
+            ReadLine.readLine(sock, buf, HELLO_TIMEOUT);
+            String line = buf.toString();
             sock.setSoTimeout(0);
-            if (line == null) {
-                log.debug("Connection closed by client");
-                return null;
-            }
             tok = new StringTokenizer(line.trim(), " ");
         } catch (SocketTimeoutException e) {
             throw new SAMException("Timeout waiting for HELLO VERSION", e);
-- 
GitLab