1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-17 04:32:04 +01:00

Refactoring work.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3179 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2005-12-08 21:10:41 +00:00 committed by gato
parent 647d6323ca
commit 38f7e5bba7

View file

@ -79,14 +79,7 @@ class PacketReader {
listenerThread.setName("Smack Listener Processor");
listenerThread.setDaemon(true);
try {
parser = new MXParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
parser.setInput(connection.reader);
}
catch (XmlPullParserException xppe) {
xppe.printStackTrace();
}
resetParser();
}
/**
@ -224,8 +217,15 @@ class PacketReader {
* when the plain connection has been secured or when a new opening stream element is going
* to be sent by the server.
*/
private void resetParser() throws XmlPullParserException {
parser.setInput(connection.reader);
private void resetParser() {
try {
parser = new MXParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
parser.setInput(connection.reader);
}
catch (XmlPullParserException xppe) {
xppe.printStackTrace();
}
}
/**
@ -335,12 +335,17 @@ class PacketReader {
connection.getSASLAuthentication().challengeReceived(parser.nextText());
}
else if (parser.getName().equals("success")) {
// The SASL authentication with the server was successful. The next step
// will be to bind the resource
connection.getSASLAuthentication().authenticated();
// We now need to bind a resource for the connection
// Open a new stream and wait for the response
connection.packetWriter.openStream();
// Reset the state of the parser since a new stream element is going
// to be sent by the server
resetParser();
// The SASL authentication with the server was successful. The next step
// will be to bind the resource
connection.getSASLAuthentication().authenticated();
}
}
else if (eventType == XmlPullParser.END_TAG) {