Nethravathitcs / unitt

Automatically exported from code.google.com/p/unitt
0 stars 0 forks source link

WebSocketClient crash while WebSocket close #46

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I use Jetty 8.1 as WebSocket server.Make sure WebSocket server is on. Run 
WebSocketClient normally. It work OK.
2. shutdown WebSocket server.
3. WebSocketClient crash as the attachment picture showed.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
UnittWebSocketClient-1.0.0-RC2

Please provide any additional information below.
I download source code of UnittWebSocketClient and read it. I found in 
WebSocket.m:

- (void)startPingTimer {
    if (self.config.keepAlive) {
        pingTimer = [NSTimer scheduledTimerWithTimeInterval:self.config.keepAlive target:self selector:@selector(repeatPing) userInfo:nil repeats:YES];
    }
}
- (void)stopPingTimer {
    if (pingTimer) {
        [pingTimer invalidate];
        [pingTimer release];
    }
}

pingTimer should not be released. it is autorelease object. I fixed it as below:
- (void)stopPingTimer {
    if (pingTimer) {
        [pingTimer invalidate];
//        [pingTimer release];
        pingTimer = nil;
    }
}

Original issue reported on code.google.com by xu.dongy...@gmail.com on 19 Jun 2012 at 6:36

Attachments:

GoogleCodeExporter commented 8 years ago
Great catch! Thanks for the fix! I will get this updated in SVN shortly.

Original comment by joshuadmorris@gmail.com on 19 Jun 2012 at 11:28

GoogleCodeExporter commented 8 years ago

Original comment by joshuadmorris@gmail.com on 20 Jun 2012 at 6:13