aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/xmpp/s2s/ConnectionOut.java')
-rw-r--r--src/main/java/com/juick/xmpp/s2s/ConnectionOut.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
index 59fdfb60..d4018ae1 100644
--- a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
+++ b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
@@ -7,14 +7,12 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.InetSocketAddress;
-import java.net.Socket;
import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.Channels;
import java.nio.channels.CompletionHandler;
import java.util.logging.Level;
import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
/**
*
@@ -55,7 +53,7 @@ public class ConnectionOut extends Connection {
sendStanza("<?xml version='1.0'?><stream:stream xmlns='jabber:server' " +
"xmlns:stream='http://etherx.jabber.org/streams' xmlns:db='jabber:server:dialback' from='" +
- XMPPComponent.HOSTNAME + "' to='" + to + "' version='1.0'>");
+ S2SComponent.HOSTNAME + "' to='" + to + "' version='1.0'>");
parser.next(); // stream:stream
streamID = parser.getAttributeValue(null, "id");
@@ -64,13 +62,13 @@ public class ConnectionOut extends Connection {
}
LOGGER.info("STREAM TO " + to + " " + streamID + " OPEN");
- XMPPComponent.addConnectionOut(ConnectionOut.this);
+ S2SComponent.addConnectionOut(ConnectionOut.this);
if (checkSID != null) {
sendDialbackVerify(checkSID, dbKey);
}
- sendStanza("<db:result from='" + XMPPComponent.HOSTNAME + "' to='" + to + "'>" + generateDialbackKey(to, XMPPComponent.HOSTNAME, streamID) + "</db:result>");
+ sendStanza("<db:result from='" + S2SComponent.HOSTNAME + "' to='" + to + "'>" + generateDialbackKey(to, S2SComponent.HOSTNAME, streamID) + "</db:result>");
while (parser.next() != XmlPullParser.END_DOCUMENT) {
if (parser.getEventType() != XmlPullParser.START_TAG) {
@@ -85,7 +83,7 @@ public class ConnectionOut extends Connection {
streamReady = true;
LOGGER.info("STREAM TO " + to + " " + streamID + " READY");
- String cache = XMPPComponent.getFromCache(to);
+ String cache = S2SComponent.getFromCache(to);
if (cache != null) {
LOGGER.info("STREAM TO " + to + " " + streamID + " SENDING CACHE");
sendStanza(cache);
@@ -100,7 +98,7 @@ public class ConnectionOut extends Connection {
String type = parser.getAttributeValue(null, "type");
String sid = parser.getAttributeValue(null, "id");
if (from != null && from.equals(to) && sid != null && !sid.isEmpty() && type != null) {
- ConnectionIn c = XMPPComponent.getConnectionIn(sid);
+ ConnectionIn c = S2SComponent.getConnectionIn(sid);
if (c != null) {
c.sendDialbackResult(from, type);
}
@@ -112,15 +110,15 @@ public class ConnectionOut extends Connection {
}
LOGGER.warning("STREAM TO " + to + " " + streamID + " FINISHED");
- XMPPComponent.removeConnectionOut(ConnectionOut.this);
+ S2SComponent.removeConnectionOut(ConnectionOut.this);
closeConnection();
} catch (EOFException eofex) {
LOGGER.info(String.format("STREAM %s %s CLOSED (dirty)", to, streamID));
- XMPPComponent.removeConnectionOut(ConnectionOut.this);
+ S2SComponent.removeConnectionOut(ConnectionOut.this);
closeConnection();
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "s2s out exception", e);
- XMPPComponent.removeConnectionOut(ConnectionOut.this);
+ S2SComponent.removeConnectionOut(ConnectionOut.this);
closeConnection();
}
}
@@ -128,20 +126,20 @@ public class ConnectionOut extends Connection {
@Override
public void failed(Throwable exc, AsynchronousSocketChannel attachment) {
LOGGER.log(Level.WARNING, "s2s out failed", exc);
- XMPPComponent.removeConnectionOut(ConnectionOut.this);
+ S2SComponent.removeConnectionOut(ConnectionOut.this);
closeConnection();
}
});
} catch (Exception e) {
LOGGER.warning(e.toString());
- XMPPComponent.removeConnectionOut(this);
+ S2SComponent.removeConnectionOut(this);
closeConnection();
}
}
public void sendDialbackVerify(String sid, String key) {
try {
- sendStanza("<db:verify from='" + XMPPComponent.HOSTNAME + "' to='" + to + "' id='" + sid + "'>" + key + "</db:verify>");
+ sendStanza("<db:verify from='" + S2SComponent.HOSTNAME + "' to='" + to + "' id='" + sid + "'>" + key + "</db:verify>");
} catch (IOException e) {
LOGGER.log(Level.WARNING, "STREAM TO " + to + " " + streamID + " ERROR", e);
}