aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java')
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java
index c15a2a25..5b1da316 100644
--- a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java
+++ b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java
@@ -58,7 +58,7 @@ public class ConnectionOut extends Connection implements Runnable {
@Override
public void run() {
- logger.info("STREAM TO " + to + " START");
+ logger.info("STREAM TO {} START", to);
try {
socket = new Socket();
socket.connect(DNSQueries.getServerAddress(to));
@@ -72,7 +72,7 @@ public class ConnectionOut extends Connection implements Runnable {
throw new Exception("STREAM TO " + to + " INVALID FIRST PACKET");
}
- logger.info("STREAM TO " + to + " " + streamID + " OPEN");
+ logger.info("STREAM TO {} {} OPEN", to, streamID);
xmpp.addConnectionOut(ConnectionOut.this);
boolean xmppversionnew = parser.getAttributeValue(null, "version") != null;
if (!xmppversionnew) {
@@ -90,16 +90,16 @@ public class ConnectionOut extends Connection implements Runnable {
String type = parser.getAttributeValue(null, "type");
if (type != null && type.equals("valid")) {
streamReady = true;
- logger.info("STREAM TO " + to + " " + streamID + " READY");
+ logger.info("STREAM TO {} {} READY", to, streamID);
String cache = xmpp.getFromCache(to);
if (cache != null) {
- logger.info("STREAM TO " + to + " " + streamID + " SENDING CACHE");
+ logger.info("STREAM TO {} {} SENDING CACHE", to, streamID);
sendStanza(cache);
}
} else {
- logger.info("STREAM TO " + to + " " + streamID + " DIALBACK FAIL");
+ logger.info("STREAM TO {} {} DIALBACK FAIL", to, streamID);
}
XmlUtils.skip(parser);
} else if (tag.equals("verify") && parser.getNamespace().equals(NS_DB)) {
@@ -116,7 +116,7 @@ public class ConnectionOut extends Connection implements Runnable {
} else if (tag.equals("features") && parser.getNamespace().equals(NS_STREAM)) {
StreamFeatures features = StreamFeatures.parse(parser);
if (sc != null && !isSecured() && features.STARTTLS >= 0 && !xmpp.brokenSSLhosts.contains(to)) {
- logger.info("STREAM TO " + to + " " + streamID + " SECURING");
+ logger.info("STREAM TO {} {} SECURING", to, streamID);
sendStanza("<starttls xmlns=\"" + NS_TLS + "\" />");
} else {
processDialback();
@@ -127,11 +127,11 @@ public class ConnectionOut extends Connection implements Runnable {
socket.getPort(), true);
((SSLSocket) socket).startHandshake();
setSecured(true);
- logger.info("STREAM " + streamID + " SECURED");
+ logger.info("STREAM {} SECURED", streamID);
restartParser();
sendOpenStream();
} catch (SSLException sex) {
- logger.error(String.format("s2s ssl error: %s %s", to, streamID), sex);
+ logger.error("s2s ssl error: {} {}, error {}", to, streamID, sex);
sendStanza("<failed xmlns\"" + NS_TLS + "\" />");
xmpp.removeConnectionOut(this);
closeConnection();
@@ -139,19 +139,20 @@ public class ConnectionOut extends Connection implements Runnable {
} else if (isSecured() && tag.equals("stream") && parser.getNamespace().equals(NS_STREAM)) {
streamID = parser.getAttributeValue(null, "id");
} else {
- logger.info("STREAM TO " + to + " " + streamID + ": " + XmlUtils.parseToString(parser, true));
+ if (logger.isInfoEnabled()) // prevent parseToString call if logger disabled
+ logger.info("STREAM TO {} {} : {}", to, streamID, XmlUtils.parseToString(parser, true));
}
}
- logger.warn("STREAM TO " + to + " " + streamID + " FINISHED");
+ logger.warn("STREAM TO {} {} FINISHED", to, streamID);
xmpp.removeConnectionOut(ConnectionOut.this);
closeConnection();
} catch (EOFException | SocketException eofex) {
- logger.info(String.format("STREAM %s %s CLOSED (dirty)", to, streamID));
+ logger.info("STREAM {} {} CLOSED (dirty)", to, streamID);
xmpp.removeConnectionOut(ConnectionOut.this);
closeConnection();
} catch (Exception e) {
- logger.error(String.format("s2s out exception: %s %s", to, streamID), e);
+ logger.error("s2s out exception: {} {}, exception {}", to, streamID, e);
xmpp.removeConnectionOut(ConnectionOut.this);
closeConnection();
}
@@ -161,7 +162,7 @@ public class ConnectionOut extends Connection implements Runnable {
try {
sendStanza("<db:verify from='" + xmpp.HOSTNAME + "' to='" + to + "' id='" + sid + "'>" + key + "</db:verify>");
} catch (IOException e) {
- logger.warn("STREAM TO " + to + " " + streamID + " ERROR", e);
+ logger.warn("STREAM TO {} {} ERROR {}", to, streamID, e);
}
}
}