forked from I2P_Developers/i2p.i2p
fix stopping of reader
This commit is contained in:
@@ -98,7 +98,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl {
|
||||
else
|
||||
return _helloOk.booleanValue() ? _version : null;
|
||||
}
|
||||
} catch (InterruptedException ie) {}
|
||||
} catch (InterruptedException ie) { return null; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl {
|
||||
else
|
||||
return _sessionCreateOk.booleanValue();
|
||||
}
|
||||
} catch (InterruptedException ie) {}
|
||||
} catch (InterruptedException ie) { return false; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl {
|
||||
else
|
||||
return _streamStatusOk.booleanValue();
|
||||
}
|
||||
} catch (InterruptedException ie) {}
|
||||
} catch (InterruptedException ie) { return false; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException ie) {}
|
||||
} catch (InterruptedException ie) { return null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ public class SAMReader {
|
||||
if (_thread != null) {
|
||||
_thread.interrupt();
|
||||
_thread = null;
|
||||
try { _inRaw.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +99,7 @@ public class SAMReader {
|
||||
baos.write(c);
|
||||
}
|
||||
if (c == -1) {
|
||||
_log.error("Error reading from the SAM bridge");
|
||||
_log.info("EOF reading from the SAM bridge");
|
||||
break;
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
@@ -106,14 +107,12 @@ public class SAMReader {
|
||||
break;
|
||||
}
|
||||
|
||||
String line = new String(baos.toByteArray());
|
||||
String line = "";
|
||||
try {
|
||||
line = new String(baos.toByteArray(), "ISO-8859-1");
|
||||
} catch (IOException ioe) {}
|
||||
baos.reset();
|
||||
|
||||
if (line == null) {
|
||||
_log.info("No more data from the SAM bridge");
|
||||
break;
|
||||
}
|
||||
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Line read from the bridge: " + line);
|
||||
|
||||
@@ -121,7 +120,6 @@ public class SAMReader {
|
||||
|
||||
if (tok.countTokens() < 2) {
|
||||
_log.error("Invalid SAM line: [" + line + "]");
|
||||
_live = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -145,6 +143,7 @@ public class SAMReader {
|
||||
|
||||
processEvent(major, minor, params);
|
||||
}
|
||||
_live = false;
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("SAMReader exiting");
|
||||
}
|
||||
|
@@ -181,12 +181,14 @@ public class SAMStreamSend {
|
||||
}
|
||||
}
|
||||
|
||||
private void send(OutputStream samOut, SAMEventHandler eventHandler) {
|
||||
private void send(OutputStream samOut, SAMEventHandler eventHandler) throws IOException {
|
||||
Sender sender = new Sender(samOut, eventHandler);
|
||||
boolean ok = sender.openConnection();
|
||||
if (ok) {
|
||||
I2PAppThread t = new I2PAppThread(sender, "Sender");
|
||||
t.start();
|
||||
} else {
|
||||
throw new IOException("Sender failed to connect");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user