@@ -76,6 +76,11 @@ public class Game {
76
76
*/
77
77
public static final CutsceneCamera cutsceneCamera = new CutsceneCamera ();
78
78
79
+ /**
80
+ * TODO use interface
81
+ */
82
+ public static final UpdateServer updateServer = new UpdateServer ();
83
+
79
84
public static FriendList friendList ;
80
85
81
86
public static final SocialList ignoreList = new SocialList (100 );
@@ -90,7 +95,7 @@ public class Game {
90
95
public static int modewhere = 0 ;
91
96
public static long lastClickTime = 0L ;
92
97
public static int mouseInvInterfaceIndex = 0 ;
93
- public static int anInt509 = 0 ;
98
+ public static int updateServerConnectAttemptCounter = 0 ;
94
99
public static boolean aBoolean519 = true ;
95
100
public static MouseCapturer mouseCapturer ;
96
101
public static int anInt2591 = 0 ;
@@ -110,7 +115,7 @@ public class Game {
110
115
public static int connectionStage = 0 ;
111
116
public static int anInt292 = 0 ;
112
117
public static boolean accountFlagged = false ;
113
- public static long aLong1841 ;
118
+ public static long updateServerHandshakeSentAtMs ;
114
119
public static int clientVersion ;
115
120
public static int playerRights = 0 ;
116
121
public static Timer gameTimer ;
@@ -871,7 +876,7 @@ public static void method353() {
871
876
}
872
877
873
878
874
- if (aBoolean519 && UpdateServer . getActiveCount (false , true ) == 0 ) {
879
+ if (aBoolean519 && updateServer . getActiveTaskCount (false , true ) == 0 ) {
875
880
aBoolean519 = false ;
876
881
}
877
882
if (aBoolean519 ) {
@@ -1596,12 +1601,12 @@ public static void handleLoginScreenActions() {
1596
1601
}
1597
1602
if (loginStatus == 1 ) { // Create connection to server, and wait for it to become available
1598
1603
if (MovedStatics .gameServerSignlinkNode == null ) {
1599
- MovedStatics .gameServerSignlinkNode = signlink .createSocketNode (currentPort );
1604
+ MovedStatics .gameServerSignlinkNode = signlink .putSocketNode (currentPort );
1600
1605
}
1601
- if (MovedStatics .gameServerSignlinkNode .status == 2 ) {
1606
+ if (MovedStatics .gameServerSignlinkNode .status == SignlinkNode . Status . ERRORED ) {
1602
1607
throw new IOException ();
1603
1608
}
1604
- if (MovedStatics .gameServerSignlinkNode .status == 1 ) {
1609
+ if (MovedStatics .gameServerSignlinkNode .status == SignlinkNode . Status . INITIALIZED ) {
1605
1610
MovedStatics .gameServerSocket = new GameSocket ((Socket ) MovedStatics .gameServerSignlinkNode .value , signlink );
1606
1611
loginStatus = 2 ;
1607
1612
MovedStatics .gameServerSignlinkNode = null ;
@@ -2137,16 +2142,16 @@ public void method35(int arg1) {
2137
2142
if (anInt292 >= 4 ) {
2138
2143
if (gameStatusCode <= 5 ) {
2139
2144
this .openErrorPage ("js5connect" );
2140
- anInt509 = 3000 ;
2145
+ updateServerConnectAttemptCounter = 3000 ;
2141
2146
} else
2142
- anInt509 = 3000 ;
2147
+ updateServerConnectAttemptCounter = 3000 ;
2143
2148
}
2144
2149
} else {
2145
2150
this .openErrorPage ("js5connect_outofdate" );
2146
2151
gameStatusCode = 1000 ;
2147
2152
}
2148
2153
} else if (gameStatusCode > 5 )
2149
- anInt509 = 3000 ;
2154
+ updateServerConnectAttemptCounter = 3000 ;
2150
2155
else {
2151
2156
this .openErrorPage ("js5connect_full" );
2152
2157
gameStatusCode = 1000 ;
@@ -2189,7 +2194,7 @@ public void processGameLoop() {
2189
2194
2190
2195
public void handleUpdateServer () {
2191
2196
if (gameStatusCode != 1000 ) {
2192
- boolean bool = UpdateServer . processUpdateServerResponse ();
2197
+ boolean bool = updateServer . poll ();
2193
2198
if (!bool )
2194
2199
connectUpdateServer ();
2195
2200
}
@@ -2238,33 +2243,33 @@ else if (gameStatusCode == 5) {
2238
2243
}
2239
2244
2240
2245
public void connectUpdateServer () {
2241
- if (UpdateServer . crcMismatches >= 4 ) {
2246
+ if (updateServer . crcMismatchesCount >= 4 ) {
2242
2247
this .openErrorPage ("js5crc" );
2243
2248
gameStatusCode = 1000 ;
2244
2249
} else {
2245
- if (UpdateServer . ioExceptions >= 4 ) {
2250
+ if (updateServer . ioExceptionsCount >= 4 ) {
2246
2251
if (gameStatusCode > 5 ) {
2247
- UpdateServer . ioExceptions = 3 ;
2248
- anInt509 = 3000 ;
2252
+ updateServer . ioExceptionsCount = 3 ;
2253
+ updateServerConnectAttemptCounter = 3000 ;
2249
2254
} else {
2250
2255
this .openErrorPage ("js5io" );
2251
2256
gameStatusCode = 1000 ;
2252
2257
return ;
2253
2258
}
2254
2259
}
2255
- if (anInt509 -- <= 0 ) {
2260
+ if (updateServerConnectAttemptCounter -- <= 0 ) {
2256
2261
do {
2257
2262
try {
2258
2263
if (connectionStage == 0 ) {
2259
- updateServerSignlinkNode = signlink .createSocketNode (currentPort );
2264
+ updateServerSignlinkNode = signlink .putSocketNode (currentPort );
2260
2265
connectionStage ++;
2261
2266
}
2262
2267
if (connectionStage == 1 ) {
2263
- if (updateServerSignlinkNode .status == 2 ) {
2268
+ if (updateServerSignlinkNode .status == SignlinkNode . Status . ERRORED ) {
2264
2269
method35 (-1 );
2265
2270
break ;
2266
2271
}
2267
- if (updateServerSignlinkNode .status == 1 )
2272
+ if (updateServerSignlinkNode .status == SignlinkNode . Status . INITIALIZED )
2268
2273
connectionStage ++;
2269
2274
}
2270
2275
if (connectionStage == 2 ) {
@@ -2274,11 +2279,11 @@ public void connectUpdateServer() {
2274
2279
buffer .putIntBE (435 ); // Cache revision
2275
2280
updateServerSocket .sendDataFromBuffer (5 , 0 , buffer .buffer );
2276
2281
connectionStage ++;
2277
- aLong1841 = System .currentTimeMillis ();
2282
+ updateServerHandshakeSentAtMs = System .currentTimeMillis ();
2278
2283
}
2279
2284
if (connectionStage == 3 ) {
2280
2285
if (gameStatusCode > 5 && updateServerSocket .inputStreamAvailable () <= 0 ) {
2281
- if (System .currentTimeMillis () + - aLong1841 > 30000L ) {
2286
+ if (System .currentTimeMillis () - updateServerHandshakeSentAtMs > 30000L ) {
2282
2287
method35 (-2 );
2283
2288
break ;
2284
2289
}
@@ -2294,7 +2299,7 @@ public void connectUpdateServer() {
2294
2299
if (connectionStage != 4 )
2295
2300
break ;
2296
2301
2297
- UpdateServer . handleUpdateServerConnection (updateServerSocket , gameStatusCode > 20 );
2302
+ updateServer . receiveConnection (updateServerSocket , gameStatusCode > 20 );
2298
2303
2299
2304
updateServerSignlinkNode = null ;
2300
2305
connectionStage = 0 ;
@@ -2335,7 +2340,7 @@ public void close() {
2335
2340
method249 ();
2336
2341
MusicSystem .syncedStop (false );
2337
2342
SoundSystem .stop ();
2338
- UpdateServer . killUpdateServerSocket ();
2343
+ updateServer . close ();
2339
2344
method947 (-1 );
2340
2345
do {
2341
2346
try {
0 commit comments