X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=inline;f=src%2Fnet%2Fpterodactylus%2Ffcp%2FFcpConnectionHandler.java;fp=src%2Fnet%2Fpterodactylus%2Ffcp%2FFcpConnectionHandler.java;h=a8132c31f8a3b03a547d7a45d642e026958b17f1;hb=930a13cd3640422a0fd23e2952cacf798286f0bc;hp=b6404c539a07a6c541830386641960f3d5b4c1d5;hpb=ce478696a8689472c1bd99e4d79eef4d822e4eff;p=jFCPlib.git diff --git a/src/net/pterodactylus/fcp/FcpConnectionHandler.java b/src/net/pterodactylus/fcp/FcpConnectionHandler.java index b6404c5..a8132c3 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) { @@ -97,10 +98,11 @@ class FcpConnectionHandler implements Runnable { assert fcpMessage != null: "fcp message is null"; fcpMessage.setField(field, value); } catch (IOException e) { + throwable = null; 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