I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit e5f186f6 authored by zzz's avatar zzz
Browse files

fix stopping of reader

parent 807e5bf9
No related branches found
No related tags found
No related merge requests found
...@@ -98,7 +98,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl { ...@@ -98,7 +98,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl {
else else
return _helloOk.booleanValue() ? _version : null; return _helloOk.booleanValue() ? _version : null;
} }
} catch (InterruptedException ie) {} } catch (InterruptedException ie) { return null; }
} }
} }
...@@ -116,7 +116,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl { ...@@ -116,7 +116,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl {
else else
return _sessionCreateOk.booleanValue(); return _sessionCreateOk.booleanValue();
} }
} catch (InterruptedException ie) {} } catch (InterruptedException ie) { return false; }
} }
} }
...@@ -134,7 +134,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl { ...@@ -134,7 +134,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl {
else else
return _streamStatusOk.booleanValue(); return _streamStatusOk.booleanValue();
} }
} catch (InterruptedException ie) {} } catch (InterruptedException ie) { return false; }
} }
} }
...@@ -161,7 +161,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl { ...@@ -161,7 +161,7 @@ public class SAMEventHandler extends SAMClientEventListenerImpl {
return val; return val;
} }
} }
} catch (InterruptedException ie) {} } catch (InterruptedException ie) { return null; }
} }
} }
} }
...@@ -42,6 +42,7 @@ public class SAMReader { ...@@ -42,6 +42,7 @@ public class SAMReader {
if (_thread != null) { if (_thread != null) {
_thread.interrupt(); _thread.interrupt();
_thread = null; _thread = null;
try { _inRaw.close(); } catch (IOException ioe) {}
} }
} }
...@@ -98,7 +99,7 @@ public class SAMReader { ...@@ -98,7 +99,7 @@ public class SAMReader {
baos.write(c); baos.write(c);
} }
if (c == -1) { if (c == -1) {
_log.error("Error reading from the SAM bridge"); _log.info("EOF reading from the SAM bridge");
break; break;
} }
} catch (IOException ioe) { } catch (IOException ioe) {
...@@ -106,14 +107,12 @@ public class SAMReader { ...@@ -106,14 +107,12 @@ public class SAMReader {
break; break;
} }
String line = new String(baos.toByteArray()); String line = "";
try {
line = new String(baos.toByteArray(), "ISO-8859-1");
} catch (IOException ioe) {}
baos.reset(); baos.reset();
if (line == null) {
_log.info("No more data from the SAM bridge");
break;
}
if (_log.shouldDebug()) if (_log.shouldDebug())
_log.debug("Line read from the bridge: " + line); _log.debug("Line read from the bridge: " + line);
...@@ -121,7 +120,6 @@ public class SAMReader { ...@@ -121,7 +120,6 @@ public class SAMReader {
if (tok.countTokens() < 2) { if (tok.countTokens() < 2) {
_log.error("Invalid SAM line: [" + line + "]"); _log.error("Invalid SAM line: [" + line + "]");
_live = false;
break; break;
} }
...@@ -145,6 +143,7 @@ public class SAMReader { ...@@ -145,6 +143,7 @@ public class SAMReader {
processEvent(major, minor, params); processEvent(major, minor, params);
} }
_live = false;
if (_log.shouldWarn()) if (_log.shouldWarn())
_log.warn("SAMReader exiting"); _log.warn("SAMReader exiting");
} }
......
...@@ -181,12 +181,14 @@ public class SAMStreamSend { ...@@ -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); Sender sender = new Sender(samOut, eventHandler);
boolean ok = sender.openConnection(); boolean ok = sender.openConnection();
if (ok) { if (ok) {
I2PAppThread t = new I2PAppThread(sender, "Sender"); I2PAppThread t = new I2PAppThread(sender, "Sender");
t.start(); t.start();
} else {
throw new IOException("Sender failed to connect");
} }
} }
......
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