Commit Graph

15 Commits

Author SHA1 Message Date
Florian Schmaus b6fb1f3743 Notify PacketReader in case of TLS exceptions
PacketReader will be waiting in startup() as long as either:
- the timeout occurs
- notify is called because the last feature stanza was parser
- notify is called because of an exception while parsing
2014-04-28 18:53:50 +02:00
Florian Schmaus bc176d72a3 Throw exceptions of SSLSocket.startHandshake() in connect()
instead of throwing a NoResponseException in case startHandshake()
throws an Exception. The NoResponseException was then thrown when
performing SASL auth, which usually directly followes securing the
connection via TLS (if enabled and provided by the server).
2014-04-28 17:36:10 +02:00
Florian Schmaus ddb47c2d60 Don't throw XmlPullParserException
removes the need to wrap the exception in a SmackException in
XMPPTCPConnection.initConnection()
2014-04-28 17:35:59 +02:00
Florian Schmaus 874a22489e Remove resource binding out of sasl auth
Follow XEP-170 recommendations: Resource binding *after* compression.

Fixes also a bunch of race conditions related to the wait()/notify()
pattern used in the early stages of a Connection where
createPacketCollectorAndSend(Packet).nextResultOrThrow() can not be
used. Those wait()/notify() patterns are currently
- SASL authentication
- compression
- resource binding

Fixes SMACK-454
2014-04-28 07:58:34 +02:00
Florian Schmaus d17f64ed9a Improve stream compression for TCP connections
Fix a race condition in useCompression where the compression request was
send outside the synchronized block, this could cause notify() to be
called without a previoius call to wait().

s/streamCompressionDenied/streamCompressionNegotiationDone/ and re-use
the method once the server ack'd stream compression.

Also don't call notifyConnectionError() when requestStreamCompression()
encounters an exception, instead throw the exception.
2014-04-27 11:39:38 +02:00
Florian Schmaus 790ebeca33 Make PacketReader.resetParser() throw the exception
there is no need to catch it and disguise it.
2014-04-27 10:49:58 +02:00
Florian Schmaus a613d5f574 Improve PacketReader startup()
Instead of using the connectionID, we now use a new boolean
lastFeaturesParsed to mark when startup() is able to continue or when a
NoResponseException should be thrown.

Fixes the problem when the connectionId was set and the wait() would
timeout, resulting in startup() believing that everything was ok, while
in fact the features where not yet received (or parsed). SMACK-558.
2014-04-27 10:49:56 +02:00
Florian Schmaus 76ce883ef3 Simplify PacketReader wait/notify code
by removing the support for non XMPP 1.0 servers.
2014-04-27 10:49:23 +02:00
Georg Lukas ab70cfec24 Refactoring: All connection classes begin with XMPP now
This commit renames classes as follows:
 * TCPConnection --> XMPPTCPConnection
 * BOSHConnection --> XMPPBOSHConnection

There are two reasons for this rename. First, it is there to indicate
that the classes actually _are_ XMPP connections, using different
transport mechanisms. Second, it makes auto-completion in IDEs easier,
the developer can type XMPP<complete> and choose the right backend.
2014-04-09 20:03:07 +02:00
Florian Schmaus 4db967079f getInstanceFor() for ChatManager and AccountManager 2014-03-19 08:59:45 +01:00
Florian Schmaus 64e7b8a868 Move getRoster() to XMPPConnection
Also remove the Exceptions from the signature of getRoster().

Extend ConnectionListener with connected() and authenticated()
callbacks, required by Roster to be notified so that the Roster can be
loaded *after* login.
2014-03-15 11:21:49 +01:00
Florian Schmaus 4b56446e40 Introduce SmackException
SmackException (and it's subclasses) is for all errors/exceptions not
defined by any XMPP specification. XMPPException is now an abstract
class for all errors defined by the XMPP specifications.

Methods that involve an IQ exchange now either return the result, which
is obtained by IQ response, or they throw an XMPPErrorException if an IQ
error was the result of the IQ set/get. If there was no response from
the server within the default packet timeout, a NoResponseException will
be thrown.

XMPP SASL errors are now also reported accordingly.

SMACK-426
2014-03-14 01:46:42 +01:00
Florian Schmaus 4b6f09f962 Move processPacket() method to XMPPConnection
This removes code duplication in BOSHConnection and TCPConnection's
PacketReader, by moving the common code to the superclass
XMPPConnection.
2014-03-14 00:25:22 +01:00
Florian Schmaus 489816c61f Renamed Connection to XMPPConnection 2014-03-10 09:45:50 +01:00
Florian Schmaus a3e64bab18 Created 'tcp' subproject for TCPConnection
Renamed XMPPConnection to TCPConnection, since the other connection type
is also called BOSHConnection.
2014-03-01 14:31:34 +01:00
Renamed from core/src/main/java/org/jivesoftware/smack/PacketReader.java (Browse further)