Changeset 3945
- Timestamp:
- 03/23/06 20:47:06 (2 years ago)
- Files:
-
- WiredClient/trunk/WCConnection.h (modified) (1 diff)
- WiredClient/trunk/WCLink.h (modified) (2 diffs)
- WiredClient/trunk/WCLink.m (modified) (5 diffs)
- WiredClient/trunk/WCServerConnection.m (modified) (6 diffs)
- WiredClient/trunk/WCTrackerConnection.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/WCConnection.h
r3673 r3945 128 128 129 129 - (void)connect; 130 - (void) disconnect;130 - (void)close; 131 131 - (void)terminate; 132 132 WiredClient/trunk/WCLink.h
r3673 r3945 44 44 BOOL _reading; 45 45 BOOL _closing; 46 BOOL _terminating; 46 47 } 47 48 … … 57 58 58 59 - (void)connect; 59 - (void)disconnect; 60 - (void)close; 61 - (void)terminate; 60 62 - (void)sendCommand:(NSString *)command; 61 63 - (void)sendCommand:(NSString *)command withArgument:(NSString *)argument1; WiredClient/trunk/WCLink.m
r3713 r3945 117 117 - (void)connect { 118 118 _reading = YES; 119 _ closing = NO;119 _terminating = NO; 120 120 121 121 [WIThread detachNewThreadSelector:@selector(linkThread:) toTarget:self withObject:NULL]; … … 131 131 132 132 133 - (void) disconnect{133 - (void)close { 134 134 _closing = YES; 135 _reading = NO; 136 } 137 138 139 140 - (void)terminate { 141 _terminating = YES; 135 142 _reading = NO; 136 143 } … … 217 224 [_delegate linkConnected:self]; 218 225 219 while(!_closing ) {226 while(!_closing && !_terminating) { 220 227 if(!loopPool) 221 228 loopPool = [[NSAutoreleasePool alloc] init]; … … 224 231 string = [_socket readStringUpToString:WCMessageSeparator encoding:NSUTF8StringEncoding timeout:1.0 error:&error]; 225 232 226 if(_closing || (string && [string length] == 0)) {233 if(_closing || _terminating || (string && [string length] == 0)) { 227 234 goto close; 228 235 } … … 252 259 [_pingTimer invalidate]; 253 260 254 if(_ closing) {261 if(_terminating) { 255 262 if(_delegateLinkTerminated) 256 263 [_delegate linkTerminated:self]; WiredClient/trunk/WCServerConnection.m
r3908 r3945 332 332 nick = [bookmark objectForKey:WCBookmarksNick]; 333 333 334 if([nick length] > 0) 335 [_link sendCommand:WCNickCommand withArgument:nick]; 334 if([nick length] == 0) 335 nick = [WCSettings objectForKey:WCNick]; 336 337 [_link sendCommand:WCNickCommand withArgument:nick]; 336 338 337 339 status = [bookmark objectForKey:WCBookmarksStatus]; 338 340 339 if([status length] > 0) 340 [_link sendCommand:WCStatusCommand withArgument:status]; 341 if([status length] == 0) 342 status = [WCSettings objectForKey:WCStatus]; 343 344 [_link sendCommand:WCStatusCommand withArgument:status]; 341 345 } 342 346 } … … 361 365 362 366 if(_link && [_link isReading]) 363 [_link disconnect];367 [_link terminate]; 364 368 else 365 369 [self postNotificationName:WCConnectionDidTerminate object:self]; … … 373 377 [_link release]; 374 378 _link = NULL; 375 376 if(!_loginFailed)377 [self autorelease];378 379 } 379 380 … … 385 386 [_progressIndicator stopAnimation:self]; 386 387 387 error = [[notification userInfo] objectForKey:WCErrorKey];388 389 if(error && [[self window] isVisible])390 [[error alert] beginSheetModalForWindow:[self window]];391 392 388 [_link release]; 393 389 _link = NULL; 394 390 395 if(![[self window] isVisible]) 396 [self postNotificationName:WCServerConnectionTriggeredEvent eventTag:WCEventsServerDisconnected]; 391 if(!_loginFailed) { 392 error = [[notification userInfo] objectForKey:WCErrorKey]; 393 394 if(error && [[self window] isVisible]) 395 [[error alert] beginSheetModalForWindow:[self window]]; 396 397 if(![[self window] isVisible]) 398 [self postNotificationName:WCServerConnectionTriggeredEvent eventTag:WCEventsServerDisconnected]; 399 } 397 400 } 398 401 … … 412 415 _loginFailed = YES; 413 416 414 [_link disconnect];417 [_link close]; 415 418 } 416 419 } … … 847 850 848 851 849 - (void) disconnect{850 [_link disconnect];852 - (void)close { 853 [_link close]; 851 854 } 852 855 WiredClient/trunk/WCTrackerConnection.m
r3673 r3945 113 113 114 114 if(_link && [_link isReading]) 115 [_link disconnect];115 [_link terminate]; 116 116 else 117 117 [self postNotificationName:WCConnectionDidTerminate object:self]; … … 315 315 316 316 317 - (void) disconnect{318 [_link disconnect];317 - (void)close { 318 [_link close]; 319 319 } 320 320
