Commit Graph

418 Commits

Author SHA1 Message Date
Wilson E. Alvarez 21f51f0f48 Fixed WebSocket.cpp memory leaks (#17653) 2017-04-10 10:28:05 +08:00
pandamicro 0e0987d337 Support notify progression in XMLHTTPRequest (#17509)
* Support notify progression in XMLHTTPRequest

* Fix indent

* Fix issues

* fix issue
2017-03-16 14:09:51 +08:00
pandamicro 0eec73ba43 Bindings fix and assets manger ex fix (#17115)
* Fix custom event being discard during event emission

* Fix tilemap black line issue

* Fix auto bindings config

* Adapt websocket to new memory model

* Improve cocos2d_specifics code stability

* Fix issue with get_or_create_js_object function

* Improve memory usage in function wrapper invocation

* Use JS Function bind to avoid memory tracking issues

* Support size parameter to collect total byte size before update process

* Fix download resuming issue on Android

* Remove temporary assets when temporary manifest is invalid or out of date

* Use version compare handle to compare manifests versions

* Support max concurrent tasks setting & download verify callback

* Add Manifest::Asset conversion

* Avoid crash caused by wrappers

* Sync implementation of tested and published AssetsManagerEx from Cocos Creator

* Fix linux compilation issues
2017-03-15 16:09:02 +08:00
James Chen 90403fc632 Fixes memory issues catched by Xcode Analyze Tool. (#17489) 2017-03-14 11:09:31 +08:00
James Chen 5c0c6d2e1e More powerful Uri class, adds unit test for Uri class. Refactors some code in SocketIO & Websocket. (#17472)
* More powerful Uri class, adds unit test for Uri class. Refactores some code in SocketIO & Websocket.

* Adds missing header file stdint.h

* Exports Uri class

* Uri belongs to network group

* Updates the location of group comment

* Removes an unused include.

* Updates Uri comment.
2017-03-09 10:14:39 +08:00
Alanmars 0cde5c6fc1 *Fix: GLThread and other threads access sDownloaderMap in a thread-unsafe way, which will result in crash in some occasion on Android. (#16326) 2017-03-07 17:00:52 +08:00
James Chen 1c0e56efef fixed #17416: Wrong default port of SocketIO connection. (#17459)
Supports SSL connection for SocketIO.
Avoid memory corruption while disconnecting SocketIO, _ws->close() has to be at the end of ‘SIOClientImpl::disconnect()’.
2017-03-07 15:49:38 +08:00
James Chen fc0ad058a5 fixed #17427: lws_parse_url has wrong behavior, it parses ’ws://domain.com/abc/d’ to ‘path: abc/d’ rather than ‘path: /adb/d’. (#17455)
* fixed #17427: lws_parse_url have wrong behavior, it parses ’ws://domain.com/abc/d’ to ‘path: abc/d’ rather than ‘path: /adb/d’.
Adds Uri class and parses Url to scheme, host, port, path in engine side.

* Moves Uri implementation to Uri.cpp, adds getter functions.

* Updates win32 project.

* Updates win10 project.

* Adds include header for atoi error on android.

* Updates tizen project configuration.
2017-03-07 13:35:59 +08:00
James Chen ce2f4e892f Websocket bug fix after PR#17440 was merged. (#17450)
* Websocket bug fix after PR#17440 was merged.

* typo fix
2017-03-07 09:35:14 +08:00
Tiffanyx 69d92bbe49 fixed #17433: [webSocket ] webSocket random crash in win32 (#17440) 2017-03-06 14:18:58 +08:00
James Chen 619e012d9b [WebSocket] Adds support for getting url and server selected protocol (#17381)
* [WebSocket] Adds support for getting url and server selected protocol

* Adds const keyword for getter methods, and make LOGE also works in release mode.
2017-02-20 09:44:20 +08:00
James Chen c553d418e4 [websocket] Pass nullptr for protocol parameter if there aren't any protocols are assigned. (#17379) 2017-02-17 11:18:13 +08:00
CocosRobot d07794052f Update license to 2017 (#17362)
* Typo: CopyRight -> Copyright

* Copyright update: chukong-inc.com -> Chukong Technologies Inc.

* [js files] Copyright update: 2014 -> 2014-2017

* [cpp files] Copyright update: 2014 -> 2014-2017

* Copyright update: 2015 -> 2015-2017

* [js files] Copyright update: 2014 -> 2014-2017

* Copyright update: 2016 -> 2016-2017

* Copyright update: 2013 -> 2013-2017

* Copyright update: 201?-201? -> 201?-2017

* License year fixes.

* Liscene year fix in CCRay.cpp

* Updates license years in CCGLProgramState.h & CCGLProgramStateCache.h
2017-02-14 14:36:57 +08:00
James Chen 4237639dd6 Some fixes for websocket (#17342)
* libwebsockets & curl are dynamic libraries now, modify project configuration for win32.
Updates WebSocketTest.cpp to test wss connection.

* Corrects some logic in WebSocket.cpp. Adds wss test case. WebSocketTest suggests developers to use `WebSocket::closeAsync` method which will not block current thread.

* mutex unlock fix in WebSocket.cpp. Reverts TEST URL.

* Allows self-assign cert.

* Each ws connection will create a virutal host now. Supports self-signed cert and update test case to suggest developer use ‘closeAsync’.

* Updates deps to 123.
2017-02-13 15:15:23 +08:00
Wilson E. Alvarez b672b94edc Removed unnecessary assignments (#17328) 2017-02-09 10:57:01 +08:00
James Chen 55a97f6107 Wrong assert logic fix in HttpClient. (#17330)
* Wrong assert logic fix in HttpClient.

* Updates assert prompt
2017-02-09 09:56:24 +08:00
minggo 92704517bc remove unneeded assignment (#17320) 2017-02-08 13:58:11 +08:00
mogemimi 75d2e76095 Fix minor typos in comments and docs (#17294) 2017-02-07 09:41:52 +08:00
mogemimi aa9ce3ccb3 Fix implicit conversion warnings (#17254) 2017-02-04 10:38:22 +08:00
Wilson E. Alvarez ca28af0113 Fixed variable order in initializer lists (#17274) 2017-02-04 10:33:58 +08:00
j-jorge c616d6d9ff Compilation fix (#17209)
* Fix various compilation issues.

Mostly errors on field initialization order but also missing files
in CMakeLists and missing include directives.

* Fix compilations issues with GCC 6.2

* Fix gitignore libs/ entry to not ignore the Android external libraries.
2017-02-04 09:46:32 +08:00
James Chen b1f2a056b2 Refactor WebSocket to support SSL (wss) (#17172)
* Refactors WebSocket:
1. Supports wss protocol
2. Uses only one libwebsockets context, multiple wsi instances to avoid multi-thread issues
3. Uses lws_create_vhost to create multiple virtual host, different protocols works

* Adds openssl include path to xcode project configuration.

* mac doesn’t depend on curl

* ca file path should be full path.

* More bug fixes like which in https://github.com/cocos2d/cocos2d-x/pull/6986

* Remove curl dependence for mac

* Updates Andorid.mk

* [win32] Adds wss support for win32, and updates openssl, libcurl, libwebsockets libraries.

* Updates external/config.json to 118.

* [win32] Updates cocos/2d/libcocos2d.vcxproj to fix compilation error while building in release mode.

* Linux support websocket ssl connection.

* Updates external/config.json

* Updates install-deps-linux.sh

* Adds dependence of binutils, print ld version

* Updates travis scripts.

* Updates travis scripts.

* Updates travis script, don’t output log while extracting.

* update before-install.sh

* updates before-install.sh

* updates before-install.sh

* don’t output log for installing software.

* Updates config.json to 120.
2017-01-19 13:55:14 +08:00
minggo c4d0d56f3a check pointer before using (#17215) 2017-01-19 09:32:58 +08:00
mogemimi efc3e5979b Fix typo in function name (#17202) 2017-01-18 15:40:46 +08:00
minggo 966d47c251 fix crash if create and delete downloader quickly (#17010) 2016-12-14 14:44:36 +08:00
minggo 84a6ab312c use correct downloader implementation on mac (#16955) 2016-12-05 09:36:35 +08:00
Wilson E. Alvarez 3056269531 Various small performance tweaks (#16881)
* These variables can be accessed by reference

* Assign values in initialization list

* _range can also be in initialization list

* Prefixed ++ and added 'auto' to loops

Also removed extra whitespace

* Prefixed ++/--, and changed for-loop implementation to use 'auto' on some loops
2016-11-22 09:54:04 +08:00
pyrosphere 663bb4d7ed No CC_UNUSED_PARAM (#16812)
* Added -Wno-unused-parameter and removed all uses of the CC_UNUSED_PARAM macro

* Commented unused parameter names in .cpp files which previously used CC_UNUSED_PARAM

* Reverted -Wno-unused-param flag.
Moved deprecated touch methods definitions to .cpp file.
Commented more unused parameter names.

* Fixed some errors and warnings caused by the previous commit.

* Commented remaining unused parameter names in .cpp files.

* Fixed unused parameter warnings in headers.

* Fixed some more unused parameter warnings.

* Fixed some more unused parameters warnings.

* Fixed mistake in previous commit, missing ComAudioReader:: in method. Other warnings.

* Fixed build errors.

* Added missing file to CMakeLists
2016-11-16 09:48:37 +08:00
UQ Times 0d2e58b9da fix compile error if "USE_STD_UNORDERED_MAP == 0". (#16831) 2016-11-14 10:00:55 +08:00
James Chen 7e14812240 fixed #16492: RapidJSON Crashes in Release mode on Android. (#16792)
* fixed #16492: RapidJSON Crashes in Release mode on Android.

* Updates external/config.json

* json/filestream.h -> json/filereadstream.h
2016-11-04 09:36:59 +08:00
Wilson E. Alvarez c0e1e91373 Performance tweak: Use range-based for-loops and allocate std::vector size() and *end() on the stack where favorable. (#16716)
* Use range-based for-loops and allocate std::vector size(), end(), cend(), rend(), crend() on the stack where favorable.

Other minor trivial changes were applied.

* Fixed Android compilation error

* Fixed windows-universal compilation error
2016-10-27 15:10:24 +08:00
mogemimi 5b8919829c Fix typos in local variables (#16712) 2016-10-20 18:17:37 +08:00
mogemimi 1ed151be82 Fix indentation (#16699) 2016-10-14 17:48:23 +08:00
Wilson E. Alvarez cdee1e11de Performance tweak: use range-based for-loops instead of iterator-based for-loops. (#16642)
* Use ++ prefix instead for non-primitive data types in CCAutoPolygon.cpp

* Use ++ prefix instead for non-primitive data types in SimpleAudioEngine.cpp

* Use ++ prefix instead for non-primitive data types in CCNodeLoaderLibrary.cpp

* Use ++ prefix instead for non-primitive data types in CCActionManagerEx.cpp

* Use ++ prefix instead for non-primitive data types in CCDataReaderHelper.cpp

* Use ++ prefix instead for non-primitive data types in HttpClient-android.cpp

* Use ++ prefix instead for non-primitive data types in CCDevice-linux.cpp

* Use ++ prefix instead for non-primitive data types in ScriptingCore.cpp

* Switched implementation to range-based for loops

* Added readability, fixed loop in CCDataReaderHelper.cpp

Thanks to Dimon4eg for the code review.
2016-10-11 10:59:44 -07:00
mogemimi 59dea5a487 Removed unnecessary comments (#16649) 2016-10-07 11:47:48 -07:00
mogemimi 63b3043dc0 Remove extra semicolon after member function definition (#16595) 2016-09-20 14:43:48 +08:00
mogemimi eca7b2392d Remove unnecessary inline keywords (#16562) 2016-09-12 09:44:21 +08:00
Allen Lee 7c298bdcd7 misspelling check on cocos directory (#16522)
Misspelling fix on some comments,
cocos/editor-support/cocostudio/CSParseBinary_generated.h
fix misspelling postion -> position
2016-09-06 10:14:14 +08:00
Rubonnek 91efab2ba7 Fix memory leak caused by packetOut in SocketIO.cpp (#16451) 2016-08-29 19:22:38 -07:00
minggo 04fd2b16b2 merge v3.13 back to v3 2016-08-29 11:57:13 +08:00
James Chen 020745ee2e Disables 'permessage-deflate' extension for WebSocket temporarily. (#16366)
Currently, we couldn't find out the exact reason.
libwebsockets official said it's probably an issue of user code since 'libwebsockets' passed AutoBahn stressed Test.
2016-08-15 13:59:01 +08:00
James Chen b135d512d2 Update copyright to 2016. (#16311) 2016-08-05 09:42:15 +08:00
mogemimi 15030ad4c3 Fix typos in log messages 2016-07-25 02:53:22 +09:00
minggo 4c2234fe20 get correct control code 2016-07-22 14:30:06 +08:00
minggo 26dd7b2698 remove curl link for Android 2016-07-21 11:56:56 +08:00
minggo 4e125d84a4 fix compiling and linking error with ndk r12b 2016-07-08 15:29:35 +08:00
mogemimi 2443e09d29 Fix typos and other mistakes in docs 2016-07-04 00:42:10 +09:00
zilongshanren 2d3785c03d fix tizen compile error 2016-06-21 19:50:00 +08:00
mogemimi a348cbda8b Move StringUtils functions from deprecated header file to ccUTF8.h (#15835)
* Move StringUtils functions outside of deprecated header

* Replace deprecated headers with 'base/ccUTF8.h'
2016-06-15 15:01:26 +08:00
mogemimi c647a95656 Fix C4267 and C4309 warnings when compiling for Windows 10 UWP 2016-05-29 14:43:28 +09:00
pandamicro ea6a6a8586 Reverse include path in network module and update web engine 2016-05-25 23:58:11 +08:00
pandamicro 8692ee176c Merge branch 'v3' of github.com:cocos2d/cocos2d-x into v3
Conflicts:
	cocos/network/HttpAsynConnection-apple.m
	cocos/network/HttpClient-android.cpp
	cocos/network/HttpClient.cpp
	cocos/network/HttpCookie.h
	cocos/network/HttpRequest.h
	cocos/network/HttpResponse.h
	cocos/network/SocketIO.cpp
	cocos/network/WebSocket.h
2016-05-25 19:19:27 +08:00
minggo 4e92b82571 Merge pull request #15716 from cezheng/bug/ios_httpclient_ssl
correct assign to equal in cert trust expression
2016-05-25 18:44:01 +08:00
Ce Zheng e4bf6584db correct assign to equal in cert trust expression 2016-05-25 18:34:05 +09:00
James Chen 1db3c1644d dlfree fix for HttpClient, the instances of Ref or its sub classes should be released by CC_SAFE_RELEASE rather than CC_SAFE_DELETE. 2016-05-25 13:54:13 +08:00
pandamicro a03c45ce62 Update network licenses and reformat 2016-05-18 14:29:54 +08:00
mogemimi 948f64631f Use const references whenever possible 2016-05-17 13:17:56 +09:00
mogemimi a1a8feed71 Add missing references to avoid unnecessary copies 2016-05-17 01:15:07 +09:00
mogemimi 16878a53b1 Suppress MSVC warning C4800 2016-05-13 11:44:17 +09:00
minggo 74af3b5232 merge v3.11 back to v3 2016-05-12 09:50:03 +08:00
pandamicro 85812b4f5b Remove client_no_context_takeover extension in WebSocket (not working on Android/iOS/Mac) 2016-05-10 20:35:02 +08:00
minggo fd160a1611 remove Content-Type limitation 2016-05-10 18:15:57 +08:00
mogemimi 2df9afbe71 Fix typos in documentation and comments 2016-05-05 08:05:20 +09:00
pandamicro fcfaafa4a5 Fix SocketIO fail to connect issue on Android 2016-05-04 17:43:36 +08:00
minggo a5602cc732 merge v3.11 back to v3 2016-05-04 16:02:23 +08:00
mogemimi a3ad4cddf8 Fix warnings about signed/unsigned mismatch 2016-04-22 12:20:05 +09:00
minggo 949112fdc2 Merge pull request #14321 from pandemosth/socketIO_issue_14287
Fix SocketIO crash on reconnect
2016-04-21 14:28:21 +08:00
Ce Zheng 200c9fda59 fix HTTPAsyncConnection bad memory management
Removed a redundant release on certDataRef that caused crash on
NSURLConnectionLoader thread.
Fixed a memory leak of SecCertificateRef
This fixes #15464
2016-04-20 14:04:44 +09:00
Ce Zheng 7f1b02ab92 Merge branch 'fix/ios_downloader_crashes_with_storage_path_containing_spaces' into fix/several_network_bugs 2016-04-20 12:12:31 +09:00
minggo 776ee8ac5a Merge pull request #14843 from cezheng/fix/ios_downloader_crashes_with_storage_path_containing_spaces
fix iOS downloader crash when storage path contains spaces
2016-04-19 13:46:02 +08:00
minggo 03ad0f01c9 Merge pull request #15001 from mogemimi/refactor-httprequest
Refactor HttpRequest and HttpResponse
2016-04-19 11:23:59 +08:00
mogemimi d1871d1ca7 Refactor HttpRequest and HttpResponse 2016-04-19 02:58:42 +09:00
Xpol Wan dc0f7bf903 Fixes format warnings. 2016-04-18 17:52:58 +08:00
James Chen 6dff5fdc13 std::shared_ptr<bool> -> std::shared_ptr<std::atomic<bool>>
The reference count field in shared_ptr is threadsafe but the value field is not. So we need to wrap a std::atomic for preventing potential thread racing.
2016-04-07 15:06:19 +08:00
minggo 6b167a1aa1 Merge pull request #15335 from mogemimi/fix-typos
Fix typos in comments and strings
2016-04-06 11:32:46 +08:00
pandamicro 3d7d5de95d Merge pull request #15317 from pandamicro/v3
Fix Socket IO handshake issue with latest version libwebsocket
2016-04-01 22:27:57 +08:00
pandamicro d93fbea0f6 Fix Socket IO connection issue on iOS 2016-03-31 21:21:20 +08:00
mogemimi 44080a04d8 Fix typos in comments and strings 2016-03-29 10:52:17 +09:00
pandamicro 7e87b8b389 Fix Socket IO handshake issue with latest version libwebsocket 2016-03-25 17:13:28 +08:00
Xpol Wan 32e408487f Fixes import path for m and mm files. 2016-03-21 20:12:58 +08:00
Xpol Wan 931d56bc10 Fixes includes in .m and .mm files. 2016-03-21 11:02:00 +08:00
Xpol Wan 90456d29ba Fixes 1605 include path in 541 files
using the tools/coding-style/include-linter.py with -f options.
2016-03-20 21:53:44 +08:00
Ricardo Quesada 9477bfd801 Merge pull request #15135 from dumganhar/ws-close-fix
Closes websocket connection by dispatching a 'resetDirector' event.
2016-03-10 17:39:47 -08:00
mogemimi 3a87ee46c6 Fix compiler warning: "/* within block comment" 2016-03-03 10:44:51 +09:00
Ricardo Quesada 028f8c28e1 Squashed commit of the following:
commit 59e43a3c80f4af8998e4a14f6463bd7a91617d5f
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Wed Mar 2 15:19:48 2016 -0800

    uses new naming convention for projects

    uses _ instead of -

commit f97ba56608d48b17909649c8617ba9047b566196
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Wed Mar 2 14:49:22 2016 -0800

    fooling cmake for real

commit 20c2560f75eab952e5131b484284bf20cb07fe07
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Wed Mar 2 14:43:05 2016 -0800

    fooling cmake

commit a0ada44bc82941830f6c71219a1492d28c28c306
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Wed Mar 2 14:26:59 2016 -0800

    makes CMake for Mac happy

commit 656b4f5e2dd741215a4699db979fe1b0dce60298
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Wed Mar 2 13:50:15 2016 -0800

    linux fix

commit fa98aeac8505c764f4a69f15c8a8ff1123fad2a3
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Wed Mar 2 11:18:18 2016 -0800

    links correctly!

commit 9c56ce7143d3a35b44d33f246cec093ca9eaa7d9
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Tue Mar 1 17:44:58 2016 -0800

    Squashed commit of the following:

    commit 2ef52723dae44204c047cb177d5a5670fb659c79
    Merge: 8a5c998 25cf1f1
    Author: Ricardo Quesada <ricardoquesada@gmail.com>
    Date:   Tue Mar 1 16:54:04 2016 -0800

        Merge branch 'v3' into cmake_android

    commit 8a5c9981192e344fffc9f14be5cb14f66eccfa24
    Author: Chaoren Lin <chaorenl@google.com>
    Date:   Thu Feb 11 18:34:46 2016 -0800

        Fix module name in Android template to match CMake project.

    commit be85e19e852a9d5fbd6c58cea60c75fe47a5a576
    Author: Chaoren Lin <chaorenl@google.com>
    Date:   Thu Feb 11 18:27:45 2016 -0800

        Add missing platform specific source file to CMake project.

    commit 705389ac6582107a381d0cbc56268eaa98ffc5c3
    Author: Chaoren Lin <chaorenl@google.com>
    Date:   Wed Feb 10 19:21:12 2016 -0800

        Find AndroidNdkModules.cmake relative to android.toolchain.cmake.

    commit a10075e2cb30af2e1f9a30da99efac880658ad6b
    Author: Chaoren Lin <chaorenl@google.com>
    Date:   Wed Feb 10 19:03:11 2016 -0800

        Remove cpp-empty-test from project templates.

    commit e070fcbf210b8628f75785e738202a80a95ac0ff
    Author: WenhaiLin <wenhai.lin@chukong-inc.com>
    Date:   Mon Aug 31 09:56:03 2015 +0800

        Fix CMake for Android Target
2016-03-02 16:51:54 -08:00
James Chen 037051d9c4 Closes websocket connection by dispatching a 'resetDirector' event. 2016-02-29 18:55:51 +08:00
James Chen 7d43e35741 Merge branch 'v3' of git://github.com/cocos2d/cocos2d-x into refactor-websocket 2016-02-17 14:56:32 +08:00
mogemimi 44d2a161dc Remove unnecessary c_str() calls 2016-02-04 11:52:14 +09:00
mogemimi 7dd7dfede7 Replace char* with std::string in HttpRequest 2016-01-26 05:13:18 +09:00
James Chen 28a3f78c65 Adds missing <mutex>, <memory> include files in WebSocket.h 2016-01-22 18:10:24 +08:00
James Chen b73b16d425 Adds isDestroy std::share_ptr variable to dectect whether websocket instance was destroyed. 2016-01-22 17:43:30 +08:00
James Chen c3e0edde06 'closed' state has to be set before quit websocket thread. 2016-01-22 16:10:49 +08:00
James Chen a64a789308 _readyState must be set to State::CLOSED and _delegate->onClose(this) must be invoked at the end of WebSocket::close. 2016-01-22 15:20:43 +08:00
James Chen ed9ed6c92f Don't change the behavior of WebSocket::close method. WebSocket::close is an synchronous method before, adds a WebSocket::closeAsync method for asynchronous closing. 2016-01-22 14:22:33 +08:00
James Chen f0066d03d7 whitespace cleanup. 2016-01-13 21:15:48 +08:00
James Chen dacd51c839 More function name renames. createThread -> createWebSocket, quitSubThread -> quitWebSocketThread. 2016-01-13 21:15:48 +08:00
James Chen 649ed67371 Removes lws_get_internal_extensions, adds permessage-deflate extension. 2016-01-13 21:15:48 +08:00
James Chen fc38857e6b LWS_SEND_BUFFER_PRE_PADDING -> LWS_PRE 2016-01-13 21:15:48 +08:00
James Chen 5d1e98340e Updates WebSocket::onSocketCallback & WebSocketTest.js 2016-01-13 21:15:48 +08:00
James Chen 2b5fde79e0 Comment fix & function name fix for WsThreadHelper:
sendMessageToUIThread -> sendMessageToCocosThread
sendMessageToSubThread -> sendMessageToWebSocketThread
joinSubThread -> joinWebSocketThread
2016-01-13 21:15:48 +08:00