and remove getConnectionID().
Also make streamId a field of AbstractXMPPConnection. Most XMPP
connection types have a streamId, it appears to be optional when BOSH
is used though.
instead of just logging a warning if the XMPP domain has no DNS SRV
lookups, create the failedAddresses list now within DNSUtil and add the
information that the SRV lookup failed.
In initConnection, only initReaderAndWriter() throws IOException.
connectUsingConfiguration doesn't need to take an argument.
PacketReader.init does not throw a SmackException.
Use Async.go() in PacketWriter, just like it's already done in PacketReader.
from o.jsmack.tcp.sm, as XEP-198 Stream Management is not an "XMPP over
TCP" exclusive feature. It could also be use together with the Websocket
binding of XMPP, so we may have a smack-streammangement in the
future. This change prepares for that by moving the SM code out of the
XMPP TCP package namespace.
if connect() was not previously called. Previously calling login() with
arguments would not check for the preconditions.
The check to throw needs to be performed in AbstractXMPPConnection
before every 'abstract login(Non)Anonymously()' call. That's the two
lines that check the preconditions are duplicated.
Also fix NPE in
XMPPTCPConnection.throwNotConnectedExceptionIfAppropriate() when
packetWrite is null (i.e. if the connection was never connected before).
InterruptedExceptions should be treated as the users intention to
'cancel' the current thread's task. There is no such thing as a
spurious interrupt (not to be confused with "spurious wakeups").
after at most 12 hours.
Also set a keep alive time for the removeCallbacksService to 30 seconds
and add AbstractXMPPConnection.schedule(Runnable, long, TimeUnit).
Note that the logic determining the max resumption time has changed,
Math.min() is now used instead of Math.max(). This should match the real
life situation, e.g. if the server announced a max resumption time of 10
minutes and the client one of 5, then it should be assumed that the
connection/stream state is dropped by the parties after 5 minutes.
From XEP-198: Stream Management § 4. Acks:
"""
Note: There are two values of 'h' for any given stream: one maintained
by the client to keep track of stanzas it has handled from the server,
and one maintained by the server to keep track of stanzas it has handled
from the client. The client initializes its value to zero when it sends
<enable/> to the server, and the server initializes its value to zero
when it sends <enabled/> to the client (it is expected that the server
will respond immediately to <enable/> and set its counter to zero at
that time).
"""
Previously smack initialized both to 0 just before sending enabled. But
according to the note from XEP-198 the server's counter is initialized
by the server "when it sends <enabled/> to the client, so we need to set
clientHandledStanzasCount to 0 when we receive <enabled/>. Because the
server started counted right after he send <enabled/>.
Thanks to Kim "zash" Alvefur for pointing this out.
instead of calling just instantShutdown(). Now we will catch this
exception, call notifyConnectionError which also calls
instantShutdown() but also notifies the connection listeners of the
event.
Smack should never all instantShutdown() without notifying the
connection listeners.
- Don't abort if there is a NotConnectedExceptions, other listeners may
want to be informed of the ack nevertheless.
- Simply return if the id is null or empty.
Add shortcut: If stanzaAcknowledgedListeners is not empty, then we don't
need to check the stanzaIdAcknowledgedListeners.
Also fixes a bug, instead of
if (id != null && stanzaAcknowledgedListeners.contains(id)) {
it must be
if (id != null && stanzaIdAcknowledgedListeners.containsKey(id)) {
to avoid confusion between the IQ element 'iq' and the IQs child
element. ELEMENT defined in an IQ sublcass should contain the *child*
element.
Add element to StreamInitation and fix FileTransferManager which still
used a packet listener instead of an IQ request handler to handle
incoming stream initiation requests.
Differentiate between asynchronous and synchronous ones. Asynchronous
are the ones where the invocation order may not be the same as the order
in which the stanzas arrived.
Since it's no longer guaranteed that when a unit test calls
processPacket(stanza)
the stanza will be completely processed when the call returns, it was
necessary to extend the unit tests (mostly Roster and ChatManager) with
a packet listener that waits for his invocation. Since we now also use
LinkedHashMaps as Map for the packet listeners (SMACK-531, SMACK-424),
adding a packet listeners as last also means that it will be called as
last. We exploit this behavior change now in the unit tests.
Rename 'recvListeners' to 'syncRecvListeners' in AbstractXMPPConnection.
Rename 'rosterInitialized' to 'loaded' in Roster.
Add Roster.isLoaded().
Reset 'loaded' to false in
Roster.setOfflinePresencesAndResetLoaded() (was setOfflinePresences()).
Fixes SMACK-583, SMACK-532, SMACK-424
on package layer instead of Declarative Service (DS) approach.
Restructuring and cleanup of initialization process to ensure that all
internal config files are found by the corresponding bundle
classloaders.
SMACK-343
Introduce AbstractError, change 'Conditions' to enums. Because of
AbstractError, it was necessary that PlainStreamElement and
TopLevelStreamElement becomes an interface. Thus the implementation of
TopLevelStreamElement.toString() had to be removed.
This adds
- policy-violation
- unexpected-request
to XMPPError.Condition, and removes the
- payment-required
- remote-server-error
- unexpected-condition
- request-timeout
Conditions
The file transfer code does now no longer throw XMPPErrorExceptions, but
SmackExceptions.
Fixes SMACK-608. Makes it possible to resolves SMACK-386.
Since c81cd34561 we can report not
connected/authenticated when the client is disconnected but the stream
could be resumed. The previous behavior caused some confusion among
the users.
The 'break' statement in the END_DOCUMENT case should break the parsing
loop and not the switch/case within. Therefore we need to add a loop
label on break on that label.
Introducing a clean split between the constant connection configuration
parameters, which are now all in ConnectionConfiguration and the dynamic
connection state (e.g. hostAddresses) which are now in
AbstractXMPPConnection.
Also removed all arguments of login() since the username, password,
resource and callback handler need now to be configured via
ConnectionConfiguration.
Also remove documentation/extensions/messageevents.md, as it's already
in documentation/legacy
- rename idStanzaAcknowledged to stanzaIdAcknowledged
- introduce smWasEnabledAtLeastOnce and throw
StreamManagementNotEnabledExceptions
- enable SM is SM resumption is enabled
Also remove unnecessary done() check in nextStreamElement() and remove
wrong comment in !instantShutdown branch. There is no mechanism to
forcible close the socket.