Automatically close forked beacon connections, fix connection forwards

This commit is contained in:
Christopher Schnick
2022-08-19 16:14:49 +02:00
parent e0266fec6b
commit 6efad1fe42
6 changed files with 10 additions and 19 deletions
@@ -18,7 +18,6 @@ public interface RawReadConnection extends DataSourceReadConnection {
default void forward(DataSourceConnection con) throws Exception {
try (var tCon = (RawWriteConnection) con) {
tCon.init();
byte[] b;
while ((b = readBytes(BUFFER_SIZE)).length > 0) {
tCon.write(b);
@@ -11,7 +11,6 @@ public interface StructureReadConnection extends DataSourceReadConnection {
default void forward(DataSourceConnection con) throws Exception {
try (var tCon = (StructureWriteConnection) con) {
tCon.init();
tCon.write(read());
}
}
@@ -28,7 +28,6 @@ public interface TextReadConnection extends DataSourceReadConnection {
default void forward(DataSourceConnection con) throws Exception {
try (var tCon = (TextWriteConnection) con) {
tCon.init();
for (var it = lines().iterator(); it.hasNext(); ) {
tCon.writeLine(it.next());
}