network connector to reconnect on proxy timeout
This commit is contained in:
parent
ec2accd9d7
commit
7d495c4824
|
@ -20,7 +20,7 @@ public interface ByteReader {
|
||||||
|
|
||||||
Logging log = getLogging(ByteReader.class);
|
Logging log = getLogging(ByteReader.class);
|
||||||
|
|
||||||
static void runReaderLoop(String loggingPrefix, DataListener listener, ByteReader reader, TcpIoStream.DisconnectListener disconnectListener, AbstractIoStream ioStream) {
|
static void runReaderLoop(String loggingPrefix, DataListener listener, ByteReader reader, AbstractIoStream ioStream) {
|
||||||
/**
|
/**
|
||||||
* Threading of the whole input/output does not look healthy at all!
|
* Threading of the whole input/output does not look healthy at all!
|
||||||
*
|
*
|
||||||
|
@ -40,7 +40,7 @@ public interface ByteReader {
|
||||||
listener.onDataArrived(Arrays.copyOf(inputBuffer, result));
|
listener.onDataArrived(Arrays.copyOf(inputBuffer, result));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("TcpIoStream: End of connection " + e);
|
log.error("TcpIoStream: End of connection " + e);
|
||||||
disconnectListener.onDisconnect();
|
ioStream.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class TcpIoStream extends AbstractIoStream {
|
||||||
public void close() {
|
public void close() {
|
||||||
super.close();
|
super.close();
|
||||||
FileUtil.close(socket);
|
FileUtil.close(socket);
|
||||||
|
disconnectListener.onDisconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -78,7 +79,7 @@ public class TcpIoStream extends AbstractIoStream {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInputListener(final DataListener listener) {
|
public void setInputListener(final DataListener listener) {
|
||||||
ByteReader.runReaderLoop(loggingPrefix, listener, input::read, disconnectListener, this);
|
ByteReader.runReaderLoop(loggingPrefix, listener, input::read, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface DisconnectListener {
|
public interface DisconnectListener {
|
||||||
|
|
|
@ -59,6 +59,7 @@ public class BaseBroadcastingThread {
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("exiting thread " + e);
|
log.error("exiting thread " + e);
|
||||||
|
stream.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue