forked from I2P_Developers/i2p.i2p
Use ReadLine for SAMHandlerFactory
This commit is contained in:
@ -46,14 +46,11 @@ class SAMHandlerFactory {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Socket sock = s.socket();
|
Socket sock = s.socket();
|
||||||
sock.setSoTimeout(HELLO_TIMEOUT);
|
|
||||||
sock.setKeepAlive(true);
|
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);
|
sock.setSoTimeout(0);
|
||||||
if (line == null) {
|
|
||||||
log.debug("Connection closed by client");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
tok = new StringTokenizer(line.trim(), " ");
|
tok = new StringTokenizer(line.trim(), " ");
|
||||||
} catch (SocketTimeoutException e) {
|
} catch (SocketTimeoutException e) {
|
||||||
throw new SAMException("Timeout waiting for HELLO VERSION", e);
|
throw new SAMException("Timeout waiting for HELLO VERSION", e);
|
||||||
|
Reference in New Issue
Block a user