Commit Graph

57 Commits

Author SHA1 Message Date
James Chen 412f71a89b [android] Fixes wrong timeout value is used. Should use timeout parameter per requrest instead of per client instance. (#1014) 2017-11-28 13:42:01 +08:00
James Chen f8b9f8134c bug fixs from #959 but except changes in CCSpriteBatchNode.cpp. (#991)
* bug fixs

* Reverts changes in CCSpriteBatchNode.cpp
2017-11-16 14:00:11 +08:00
James Chen d904232f95 Uses shorter module name (cocos2dx_internal_static -> cis) to avoid compilation errors on Windows system which has a limitation of 260 bytes for build path. (#979)
Yep, probably, we could define `buildDir` variable in build.gradle, but let's investigate later.
2017-11-12 09:16:54 +08:00
James Chen 08b38745a0 . -> , 2017-10-11 16:35:18 +08:00
James Chen 1764e440cd Comments code of listening EVENT_RESET in WebSocket-libwebsockets.cpp since it isn't needed for JSB.
Minior fix: CCLOG -> LOGD in jsb_xmlhttprequest.cpp.
2017-10-11 16:33:02 +08:00
James Chen 8230176ccb Fixes crash while click restart button in network test. (#829)
* Sync PR(https://github.com/cocos2d/cocos2d-x/pull/17921): remove "system" usage which is removed from iOS11.

* Fixes crash while click `restart` button in network test.

* printf -> LOGD

* Memory leak fix in XMLHttpRequest binding code.
2017-09-20 01:48:15 -05:00
James Chen 53e07c1da7 Merge branch 'v1.6' of git://github.com/cocos-creator/cocos2d-x-lite into jsb2.0 2017-09-07 18:32:24 +08:00
James Chen 703e857352 Synchronize network changes from cocos2d-x. 2017-08-30 13:56:41 +08:00
James Chen dc6ebc164a websocket-apple.mm needs to be compiled as ARC enabled. 2017-08-28 11:17:45 +08:00
James Chen 7653cb453f Merge branch 'develop' of git://github.com/cocos-creator/cocos2d-x-lite into jsb2.0
# Conflicts:
#	build/cocos2d_libs.xcodeproj/project.pbxproj
#	cocos/2d/libcocos2d.vcxproj.filters
#	cocos/Android.mk
#	cocos/editor-support/creator/CCCameraNode.cpp
#	cocos/editor-support/creator/physics/CCPhysicsAABBQueryCallback.cpp
#	cocos/editor-support/creator/physics/CCPhysicsAABBQueryCallback.h
#	cocos/network/SocketIO.cpp
#	cocos/network/WebSocket-libwebsockets.cpp
#	cocos/renderer/CCTextureCache.cpp
#	cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js
#	cocos/scripting/js-bindings/auto/jsb_box2d_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_box2d_auto.hpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.hpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.hpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.hpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_webView_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_webView_auto.hpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.hpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.hpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.hpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp
#	cocos/scripting/js-bindings/auto/jsb_creator_auto.cpp
#	cocos/scripting/js-bindings/auto/jsb_creator_auto.hpp
#	cocos/scripting/js-bindings/manual/JavaScriptJavaBridge.h
#	cocos/scripting/js-bindings/manual/JavaScriptObjCBridge.h
#	cocos/scripting/js-bindings/manual/ScriptingCore.cpp
#	cocos/scripting/js-bindings/manual/ScriptingCore.h
#	cocos/scripting/js-bindings/manual/box2d/js_bindings_box2d_manual.cpp
#	cocos/scripting/js-bindings/manual/box2d/js_bindings_box2d_manual.h
#	cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp
#	cocos/scripting/js-bindings/manual/cocos2d_specifics.hpp
#	cocos/scripting/js-bindings/manual/creator/js_bindings_creator_manual.cpp
#	cocos/scripting/js-bindings/manual/dragonbones/jsb_cocos2dx_dragonbones_manual.cpp
#	cocos/scripting/js-bindings/manual/dragonbones/jsb_cocos2dx_dragonbones_manual.h
#	cocos/scripting/js-bindings/manual/experimental/jsb_cocos2dx_experimental_video_manual.cpp
#	cocos/scripting/js-bindings/manual/experimental/jsb_cocos2dx_experimental_webView_manual.cpp
#	cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp
#	cocos/scripting/js-bindings/manual/js_bindings_config.h
#	cocos/scripting/js-bindings/manual/js_bindings_opengl.cpp
#	cocos/scripting/js-bindings/manual/js_manual_conversions.cpp
#	cocos/scripting/js-bindings/manual/js_manual_conversions.h
#	cocos/scripting/js-bindings/manual/js_module_register.cpp
#	cocos/scripting/js-bindings/manual/js_module_register.h
#	cocos/scripting/js-bindings/manual/jsb_event_dispatcher_manual.cpp
#	cocos/scripting/js-bindings/manual/jsb_event_dispatcher_manual.h
#	cocos/scripting/js-bindings/manual/jsb_helper.h
#	cocos/scripting/js-bindings/manual/jsb_opengl_functions.cpp
#	cocos/scripting/js-bindings/manual/jsb_opengl_functions.h
#	cocos/scripting/js-bindings/manual/jsb_opengl_manual.cpp
#	cocos/scripting/js-bindings/manual/jsb_opengl_manual.h
#	cocos/scripting/js-bindings/manual/jsb_opengl_registration.cpp
#	cocos/scripting/js-bindings/manual/localstorage/js_bindings_system_functions.cpp
#	cocos/scripting/js-bindings/manual/localstorage/js_bindings_system_functions.h
#	cocos/scripting/js-bindings/manual/localstorage/js_bindings_system_registration.cpp
#	cocos/scripting/js-bindings/manual/network/XMLHTTPRequest.cpp
#	cocos/scripting/js-bindings/manual/network/js_network_manual.cpp
#	cocos/scripting/js-bindings/manual/network/js_network_manual.h
#	cocos/scripting/js-bindings/manual/network/jsb_socketio.cpp
#	cocos/scripting/js-bindings/manual/network/jsb_websocket.cpp
#	cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.cpp
#	cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.h
#	cocos/scripting/js-bindings/manual/platform/ios/JavaScriptObjCBridge.h
#	cocos/scripting/js-bindings/manual/platform/ios/JavaScriptObjCBridge.mm
#	cocos/scripting/js-bindings/manual/spidermonkey_specifics.h
#	cocos/scripting/js-bindings/manual/spine/jsb_cocos2dx_spine_manual.cpp
#	cocos/scripting/js-bindings/manual/spine/jsb_cocos2dx_spine_manual.h
#	cocos/scripting/js-bindings/manual/ui/jsb_cocos2dx_ui_manual.cpp
#	cocos/scripting/js-bindings/proj.android/Android.mk
#	cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj
#	cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj
#	cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters
#	cocos/scripting/js-bindings/script/jsb_boot.js
#	tools/bindings-generator
#	tools/tojs/cocos2dx.ini
#	tools/tojs/genbindings.py
2017-08-10 18:04:24 +08:00
James Chen 675df73533 update HttpClient-android.cpp 2017-08-10 16:55:12 +08:00
James Chen e86ed76abf jsb2.0 windows works on v8. 2017-08-09 18:06:33 +08:00
James Chen 1a26f52b4c cleanup. 2017-08-08 16:18:48 +08:00
James Chen b398292431 Removes deprecated api for httprequest. cleanup xmlhttprequest. 2017-08-07 15:00:29 +08:00
James Chen bff5521359 cleanup for android. 2017-07-21 17:53:01 +08:00
James Chen 900d04d5af SocketIO memory leak while connecting to an invalid server url. 2017-07-21 11:50:29 +08:00
James Chen a3195fe6f5 memory leak fix. 2017-07-21 11:14:13 +08:00
James Chen ceaf5a1ed0 cleanup 2017-07-20 17:49:56 +08:00
James Chen 06bdbf4560 Uses SocketRocket for iOS & macOS. 2017-07-20 17:49:32 +08:00
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
James Chen b8c1493850 socketio bindings ok, and fix some bugs of socketio. 2017-07-10 16:40:33 +08:00
Nan Wang ed08907c1e fix websocket include 2017-07-06 11:07:10 +08:00
James Chen da17c672c1 fixes include in WebSocket-libwebsockets.cpp. 2017-07-05 18:06:44 +08:00
Wang Nan e9617ca0a6 Merge pull request #685 from dumganhar/fix/socketrocket
Uses SocketRocket to implement WebSocket for iOS
2017-07-05 17:55:46 +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
pandamicro d300701125 Fix android sub module dependency issue 2017-07-04 16:35:42 +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 18537b6a8a Updates project configuration for win32 and assert logic fix for HttpClient. 2017-02-16 11:13:31 +08:00
James Chen 31326476c7 Updates WebSocket.cpp/h to support wss. 2017-02-16 11:13:31 +08:00
pandamicro 1da6a0e5ae Revert Network modifications 2017-02-06 12:37:44 +08:00
pandamicro cec9760bd0 Fix websocket cycling destructor issue 2017-01-22 18:43:32 +08:00
pandamicro bc915ddc44 Add Downloader bindings 2017-01-16 13:57:10 +08:00
pandamicro c47a770877 Adapt websocket to new memory model 2017-01-06 16:59:40 +08:00
pandamicro 9bf561baee Upgrade to v3.13 release 2016-08-26 14:30:32 +08:00
pandamicro 1dd701936b Fix compilation issues on Mac 2016-08-11 13:57:51 +08:00
pandamicro bcbc4e1131 Upgrade cocos/math & cocos/network to v3.13 2016-08-05 18:13:16 +08:00
Nan Wang 6afe3f0b5d revert websocket change to support ipv6 network. 2016-07-27 18:12:19 +08:00
Wenhai Lin 14d3fc1fdb Fixed crash 2016-05-20 11:52:13 +08:00
pandamicro cac05f6128 Add AssetsManagerEx to extension 2016-05-18 15:21:56 +08:00
Wenhai Lin 5dcd5ed979 Use const references whenever possible 2016-05-18 14:26:43 +08:00
knoxHuang 3e79d5cab9 fix WebSocket bug for JSB 2016-05-18 10:09:43 +08:00
Wenhai Lin 850c479516 Sync Bug fix:
1. HttpClient: remove Content-Type limitation
2.VideoPlayer/WebView: hide system native control when the Node leaves the 'stage'
2016-05-12 14:26:28 +08:00
Wenhai Lin d4481bfd5a Refine (#48) 2016-04-28 11:58:34 +08:00
Wenhai Lin 6da52bccad Refine Websocket 2016-04-27 14:16:02 +08:00
Wenhai Lin 94501cc8f1 Bug fix and stability improvements 2016-04-25 15:56:03 +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 e6e2d22724 Bug fix:
1.Downloader crash when storage path contains spaces on iOS
2.Memory leak when read empty file
3.Actions may not have been executed
4.TMXXMLParser::TMXObjectInfo support "id" key
2016-04-19 16:33:21 +08:00