Bläddra i källkod

Added DISCONNECTING server state. Should fix 'event called from parser that's not in use' errors.

Might fix issue 701

git-svn-id: http://svn.dmdirc.com/trunk@3644 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Chris Smith 16 år sedan
förälder
incheckning
b537317b3f

+ 18
- 12
src/com/dmdirc/Server.java Visa fil

@@ -230,6 +230,9 @@ public final class Server extends WritableFrameContainer implements Serializable
230 230
             case CONNECTING:
231 231
                 disconnect(configManager.getOption(DOMAIN_GENERAL, "quitmessage"));
232 232
                 break;
233
+            case DISCONNECTING:
234
+                onSocketClosed();
235
+                break;
233 236
             default:
234 237
                 // Do nothing
235 238
                 break;
@@ -327,24 +330,24 @@ public final class Server extends WritableFrameContainer implements Serializable
327 330
                 break;
328 331
             }
329 332
 
330
-            myState = ServerState.DISCONNECTED;
333
+            myState = ServerState.DISCONNECTING;
331 334
         }
332 335
 
333 336
         removeInvites();
334 337
         updateIcon();
335 338
 
336
-        if (parser != null && parser.getSocketState() == IRCParser.STATE_OPEN) {
339
+        if (parser != null) {
337 340
             parser.disconnect(reason);
341
+        }
338 342
 
339
-            if (configManager.getOptionBool(DOMAIN_GENERAL, "closechannelsonquit", false)) {
340
-                closeChannels();
341
-            } else {
342
-                clearChannels();
343
-            }
343
+        if (configManager.getOptionBool(DOMAIN_GENERAL, "closechannelsonquit", false)) {
344
+            closeChannels();
345
+        } else {
346
+            clearChannels();
347
+        }
344 348
 
345
-            if (configManager.getOptionBool(DOMAIN_GENERAL, "closequeriesonquit", false)) {
346
-                closeQueries();
347
-            }
349
+        if (configManager.getOptionBool(DOMAIN_GENERAL, "closequeriesonquit", false)) {
350
+            closeQueries();
348 351
         }
349 352
     }
350 353
 
@@ -1071,9 +1074,13 @@ public final class Server extends WritableFrameContainer implements Serializable
1071 1074
         handleNotification("socketClosed", getName());
1072 1075
 
1073 1076
         ActionManager.processEvent(CoreActionType.SERVER_DISCONNECTED, null, this);
1077
+        
1078
+        eventHandler.unregisterCallbacks();
1074 1079
 
1075 1080
         synchronized (myState) {
1076
-            if (myState == ServerState.CLOSING || myState == ServerState.DISCONNECTED) {
1081
+            if (myState == ServerState.CLOSING
1082
+                    || myState == ServerState.DISCONNECTED
1083
+                    || myState == ServerState.DISCONNECTING) {
1077 1084
                 // This has been triggered via .disconect()
1078 1085
                 return;
1079 1086
             }
@@ -1113,7 +1120,6 @@ public final class Server extends WritableFrameContainer implements Serializable
1113 1120
                 return;
1114 1121
             }
1115 1122
 
1116
-            assert myState == ServerState.CONNECTING;
1117 1123
             myState = ServerState.TRANSIENTLY_DISCONNECTED;
1118 1124
         }
1119 1125
 

+ 2
- 0
src/com/dmdirc/ServerState.java Visa fil

@@ -32,6 +32,8 @@ public enum ServerState {
32 32
     TRANSIENTLY_DISCONNECTED,
33 33
     /** Indicates that the user has told us to disconnect. */
34 34
     DISCONNECTED,
35
+    /** In the process of disconnecting. */
36
+    DISCONNECTING,
35 37
     /** Indicates we're waiting for the auto-reconnect timer to fire. */
36 38
     RECONNECT_WAIT,
37 39
     /** Indicates that the server frame and its children are closing. */

+ 1
- 1
src/com/dmdirc/config/prefs/PreferencesManager.java Visa fil

@@ -30,8 +30,8 @@ import com.dmdirc.themes.ThemeManager;
30 30
 import com.dmdirc.ui.swing.components.pluginpanel.PluginPanel;
31 31
 import com.dmdirc.ui.swing.dialogs.prefs.URLConfigPanel;
32 32
 import com.dmdirc.ui.swing.dialogs.prefs.UpdateConfigPanel;
33
-
34 33
 import com.dmdirc.util.ListenerList;
34
+
35 35
 import java.util.ArrayList;
36 36
 import java.util.HashMap;
37 37
 import java.util.List;

Laddar…
Avbryt
Spara