aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-05-10 00:09:51 +0300
committerGravatar Vitaly Takmazov2016-05-10 00:09:51 +0300
commit9ae5e24191a581395221b728d0b49d6e3d0c5e5e (patch)
tree509204ae1be7e03bd457b5c2a52f576d26e843c0 /src
parentd8fd208f35e92551dc96ce906d2f761a0e53af66 (diff)
more s2s fixes
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/xmpp/s2s/ConnectionIn.java12
-rw-r--r--src/main/java/com/juick/xmpp/s2s/ConnectionOut.java2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java b/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java
index 8fa773b7..a7d687d2 100644
--- a/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java
+++ b/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java
@@ -46,8 +46,7 @@ public class ConnectionIn extends Connection implements Runnable {
parser.next(); // stream:stream
updateTsRemoteData();
if (!parser.getName().equals("stream")
- || !parser.getNamespace("stream").equals(NS_STREAM)
- || !parser.getNamespace("db").equals(NS_DB)) {
+ || !parser.getNamespace("stream").equals(NS_STREAM)) {
// || !parser.getAttributeValue(null, "version").equals("1.0")
// || !parser.getAttributeValue(null, "to").equals(Main.HOSTNAME)) {
throw new Exception("STREAM FROM ? " + streamID + " INVALID FIRST PACKET");
@@ -85,7 +84,7 @@ public class ConnectionIn extends Connection implements Runnable {
XMPPComponent.executorService.submit(c);
}
} else {
- throw new Exception("STREAM FROM " + dfrom + " " + streamID + " DIALBACK RESULT FAIL");
+ throw new HostUnknownException("STREAM FROM " + dfrom + " " + streamID + " INVALID TO " + to);
}
} else if (tag.equals("verify") && parser.getNamespace().equals(NS_DB)) {
String vfrom = parser.getAttributeValue(null, "from");
@@ -157,6 +156,8 @@ public class ConnectionIn extends Connection implements Runnable {
LOGGER.info(String.format("STREAM %s CLOSED (dirty)", streamID));
XMPPComponent.removeConnectionIn(this);
closeConnection();
+ } catch (HostUnknownException e) {
+ LOGGER.warning(e.getMessage());
} catch (Exception e) {
LOGGER.log(Level.WARNING, "STREAM " + streamID + " ERROR", e);
XMPPComponent.removeConnectionIn(this);
@@ -211,4 +212,9 @@ public class ConnectionIn extends Connection implements Runnable {
}
return false;
}
+ class HostUnknownException extends Exception {
+ public HostUnknownException(String message) {
+ super(message);
+ }
+ }
}
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
index a80e88ff..607cd20a 100644
--- a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
+++ b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
@@ -148,7 +148,7 @@ public class ConnectionOut extends Connection implements Runnable {
XMPPComponent.removeConnectionOut(ConnectionOut.this);
closeConnection();
} catch (Exception e) {
- LOGGER.log(Level.SEVERE, "s2s out exception", e);
+ LOGGER.log(Level.SEVERE, String.format("s2s out exception: %s %s", to, streamID), e);
XMPPComponent.removeConnectionOut(ConnectionOut.this);
closeConnection();
}