Yaaic/application/src/org/yaaic/irc
Steven Luo aaf3f3e332 Prevent race between IRCConnection dispose() and onDisconnect() when quitting
When the user asks for a disconnect from the ConversationActivity, there
is a race between the IRCConnection, which is waiting for the server to
acknowledge the QUIT before calling onDisconnect(), and the IRCService,
which will invoke dispose() on the IRCConnection when
checkServiceStatus() is called during the activity shutdown.  If the
dispose() wins, the thread running the onDisconnect() is terminated,
leading to the cleanup being unfinished.  This causes the disconnect
notification to be unreliable, and can result in the list of servers in
the ongoing notification to be out of sync with reality.

To fix this, introduce a new field isQuitting to the IRCConnection,
which is set to true when quitServer() is called and cleared once
onDisconnect() has finished.  If dispose() is called while isQuitting is
set, it sets disposeRequested instead of doing the dispose itself, and
onDisconnect() will call through to super.dispose() once it's finished.

Note that this requires a change to PircBot to allow the overriding of
quitServer(String message), which is declared final upstream.
2011-06-08 23:11:29 +02:00
..
IRCBinder.java Some more simple refactorings 2011-03-14 22:15:13 +01:00
IRCConnection.java Prevent race between IRCConnection dispose() and onDisconnect() when quitting 2011-06-08 23:11:29 +02:00
IRCService.java Bugfix notification system 2011-06-08 23:11:28 +02:00