X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Ffcp%2FFcpConnectionHandler.java;h=ba6b86b6d31bc6629cbc173f27b9dc12f9b368bb;hb=e661a133eb50f60545cbb0b6ffb6b2f581155abe;hp=b6404c539a07a6c541830386641960f3d5b4c1d5;hpb=f553531be78d6d6d95dc152728f2b8d40242b57d;p=jFCPlib.git diff --git a/src/net/pterodactylus/fcp/FcpConnectionHandler.java b/src/net/pterodactylus/fcp/FcpConnectionHandler.java index b6404c5..ba6b86b 100644 --- a/src/net/pterodactylus/fcp/FcpConnectionHandler.java +++ b/src/net/pterodactylus/fcp/FcpConnectionHandler.java @@ -26,7 +26,7 @@ import java.nio.charset.Charset; /** * Handles an FCP connection to a node. - * + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> * @version $Id$ */ @@ -47,7 +47,7 @@ class FcpConnectionHandler implements Runnable { /** * Creates a new connection handler that operates on the given connection * and input stream. - * + * * @param fcpConnection * The underlying FCP connection * @param remoteInputStream @@ -63,6 +63,7 @@ class FcpConnectionHandler implements Runnable { */ public void run() { FcpMessage fcpMessage = null; + Throwable throwable = null; while (true) { synchronized (this) { if (shouldStop) { @@ -96,11 +97,12 @@ class FcpConnectionHandler implements Runnable { String value = line.substring(equalSign + 1); assert fcpMessage != null: "fcp message is null"; fcpMessage.setField(field, value); - } catch (IOException e) { + } catch (IOException ioe1) { + throwable = ioe1; break; } } - fcpConnection.handleDisconnect(); + fcpConnection.handleDisconnect(throwable); } /** @@ -119,7 +121,7 @@ class FcpConnectionHandler implements Runnable { /** * Reads bytes from {@link #remoteInputStream} until ‘\r’ or ‘\n’ are * encountered and decodes the read bytes using UTF-8. - * + * * @return The decoded line * @throws IOException * if an I/O error occurs