Commit Graph

14 Commits

Author SHA1 Message Date
James Chen 68be4dbbaf Fix potential crash after WebSocket.close.
Since the finalize function will get a invalid pointer of WebSocket, invoking ws->closeAysnc() will generate unknown result, probably crash.
HOW TO FIX:
WebSocket and JSB_WebSocketDelegate inhert from Ref. After websocket is initialized successfully, retain websocket instance and delegate, they will both have 2 reference count.
release their reference both in onClose callback and finalize function. The reason is that the order of invoking onClose and finalize function will be unpredictable, ref count technique help to handle this.

Another fix is sending onclose event after onerror is received.
2017-07-20 16:43:24 +08:00
Nan Wang ed08907c1e fix websocket include 2017-07-06 11:07:10 +08:00
James Chen 1ba17074d1 Uses SocketRocket to implement WebSocket for iOS. It has the following benefits:
1. The API of SocketRocket is easy for use, it's all asynchronous API.
2. No need to deal with thread communications, it's wrapped inside SocketRocket.
3. Network status change will not make connection closed, it just seems there isn't any status change.
4. Locking screen will trigger an error while libwebsockets or bsd socket will not.
5. Don't depend on openssl library which is a little big.
6. Don't need to use a local CA root certificate (curl ca file is over 2MB) for wss connection
7. Don't trigger signal pipe while closing wss connection
8. Easy to integrate SocketRocket to current WebSocket implementation
2017-07-05 16:32:57 +08:00
James Chen fc98b4bdc0 Sync with cocos2d-x v3 branch ddb4dc8 commit. 2017-04-24 10:49:02 +08:00
James Chen 779cc28217 Sync from https://github.com/cocos2d/cocos2d-x/pull/17381 2017-02-20 10:46:28 +08:00
James Chen 92c0b0e5dc Updates license year. 2017-02-16 11:17:32 +08:00
James Chen 2b459eaf36 Synchronizes changes in https://github.com/cocos2d/cocos2d-x/pull/17342 2017-02-16 11:15:45 +08:00
James Chen 31326476c7 Updates WebSocket.cpp/h to support wss. 2017-02-16 11:13:31 +08:00
pandamicro bcbc4e1131 Upgrade cocos/math & cocos/network to v3.13 2016-08-05 18:13:16 +08:00
Wenhai Lin 6da52bccad Refine Websocket 2016-04-27 14:16:02 +08:00
Wenhai Lin 83fc6fd1a8 Bug fix:
1.Fixed crash in win for rich text
2.Fixed crash when custom SSL certificate is set on iOS
3.Fixed SocketIO crash on reconnect
4.Fixed ActionManager memory leak
5.Fixed crash in MenuItem::activate
6.Fixed crash on exit game
7.Fixed crash in TableView::updateCellAtIndex
8.Fixed crash in RichText on window
2016-04-21 15:19:47 +08:00
Wenhai Lin 94c95d5838 Withespaces does matter. 2016-03-31 23:50:02 +08:00
Wenhai Lin 8257556bc5 Fixed compile errors and warnings 2016-03-30 17:13:15 +08:00
Wenhai Lin a6dbf31dcf cocos 2d lite version 2016-03-29 17:55:48 +08:00