aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-01-26 21:22:08 +0300
committerGravatar Vitaly Takmazov2016-01-26 21:22:08 +0300
commite5dba294763f40a5e3fd8e997d4ea3f507142924 (patch)
treed6ee31ba5e3cee7735907642498086f3e3819ae8
parent72abd7c5f31f2db7606ef8ca6b38e09a899de51d (diff)
ConnectionIn: handle EOF
-rw-r--r--src/main/java/com/juick/xmpp/s2s/ConnectionIn.java10
1 files changed, 10 insertions, 0 deletions
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<String> from = new ArrayList<String>();
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();