From e5dba294763f40a5e3fd8e997d4ea3f507142924 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 26 Jan 2016 21:22:08 +0300 Subject: ConnectionIn: handle EOF --- src/main/java/com/juick/xmpp/s2s/ConnectionIn.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main') diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java b/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java index 8150cc27..f484c9db 100644 --- a/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java +++ b/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java @@ -5,12 +5,16 @@ import com.juick.xmpp.JID; import com.juick.xmpp.Message; import com.juick.xmpp.Presence; import com.juick.xmpp.utils.XmlUtils; + +import java.io.EOFException; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.Socket; import java.util.ArrayList; import java.util.UUID; +import java.util.logging.Logger; + import org.xmlpull.v1.XmlPullParser; /** @@ -19,6 +23,8 @@ import org.xmlpull.v1.XmlPullParser; */ public class ConnectionIn extends Connection implements Runnable { + private static final Logger LOGGER = Logger.getLogger(ConnectionIn.class.getName()); + final public ArrayList from = new ArrayList(); public long tsRemoteData = 0; public long packetsRemote = 0; @@ -137,6 +143,10 @@ public class ConnectionIn extends Connection implements Runnable { System.err.println("STREAM " + streamID + " FINISHED"); XMPPComponent.removeConnectionIn(this); closeConnection(); + } catch (EOFException ex) { + LOGGER.info(String.format("STREAM %s CLOSED (dirty)", streamID)); + XMPPComponent.removeConnectionIn(this); + closeConnection(); } catch (Exception e) { System.err.println("STREAM " + streamID + " ERROR:" + e.toString()); e.printStackTrace(); -- cgit v1.2.3