1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-06-18 09:24:49 +02:00
Smack/smack-tcp/src
Florian Schmaus c9eb6323c0 Fix a race on graceful disconnect
A sequence of connect(), disconnect(), and connect() could cause the
connection to get disconnected again by the old reader thread, which was
blocking on disconnect because a closing stream tag was read. If the
second connect() was processed before the disconnect(), then the
connectin would get disconnected right after the second connect().

This showed up as a "strange" sequence of stanzas in the XMPP servers
log. Note that the stanza ID of the unavailable presence has a lower
number then the previous stanzas:

Jun 11 23:11:11 c2s18c2370      debug   Resource bound: smack-inttest-two-93t70@geekplace.eu/two-93t70
Jun 11 23:11:11 c2s18c2370      debug   Received[c2s]: <iq id='qn03S-26' type='get'>
Jun 11 23:11:11 c2s18c2370      debug   Received[c2s]: <presence id='qn03S-27'>
Jun 11 23:11:11 c2s18c2370      debug   Received[c2s]: <presence id='qn03S-23' type='unavailable'>
Jun 11 23:11:11 c2s18c2370      debug   Received </stream:stream>

This is because the disconnect() of the first reader thread could
generate the unavailable presence, but was blocked afterwards when
entering the synchronized disconnect(Presence unavailablePresence).

SMACK-633.
2015-06-13 19:26:57 +02:00
..
main Fix a race on graceful disconnect 2015-06-13 19:26:57 +02:00
test/java/org/jivesoftware/smack Remove package-info.java from test packages 2015-04-05 10:48:00 +02:00