project_files/HedgewarsMobile/Classes/EngineProtocolNetwork.m
branchios-revival
changeset 11137 14f50dde3e8c
parent 11107 553899c1ff78
child 11148 064a53861759
equal deleted inserted replaced
11136:9b5f60bc059e 11137:14f50dde3e8c
   212     return SDLNet_TCP_Send(csd, [string UTF8String], length);
   212     return SDLNet_TCP_Send(csd, [string UTF8String], length);
   213 }
   213 }
   214 
   214 
   215 // this is launched as thread and handles all IPC with engine
   215 // this is launched as thread and handles all IPC with engine
   216 -(void) engineProtocol:(id) object {
   216 -(void) engineProtocol:(id) object {
   217     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   217     @autoreleasepool {
       
   218     
   218     NSDictionary *gameConfig = (NSDictionary *)object;
   219     NSDictionary *gameConfig = (NSDictionary *)object;
   219     NSMutableArray *statsArray = nil;
   220     NSMutableArray *statsArray = nil;
   220     TCPsocket sd;
   221     TCPsocket sd;
   221     IPaddress ip;
   222     IPaddress ip;
   222     int eProto;
   223     int eProto;
   401 
   402 
   402     // Close the client socket
   403     // Close the client socket
   403     [HWUtils freePort:self.enginePort];
   404     [HWUtils freePort:self.enginePort];
   404     SDLNet_TCP_Close(csd);
   405     SDLNet_TCP_Close(csd);
   405     SDLNet_Quit();
   406     SDLNet_Quit();
   406 
   407     
   407     [pool release];
   408     }
       
   409 
   408     // Invoking this method should be avoided as it does not give your thread a chance
   410     // Invoking this method should be avoided as it does not give your thread a chance
   409     // to clean up any resources it allocated during its execution.
   411     // to clean up any resources it allocated during its execution.
   410     //[NSThread exit];
   412     //[NSThread exit];
   411 }
   413 }
   412 
   414