Modified websocket timeout value for optimization 20/93120/1
authorkmook <kmook.choi@samsung.com>
Thu, 20 Oct 2016 09:46:06 +0000 (18:46 +0900)
committerkmook <kmook.choi@samsung.com>
Thu, 20 Oct 2016 09:46:06 +0000 (18:46 +0900)
Change-Id: I6db5886947a484a495730e3b4ed3b2bc68d02cb2
Signed-off-by: kmook <kmook.choi@samsung.com>
msf_tizen_client/src/Channel.cpp

index dabb94a..4248c06 100755 (executable)
@@ -71,7 +71,7 @@ Channel::Channel() {
        clientisHost = false;
        //isWrite = false;
        //buflen = 0;
-       was_closed = 1;
+       was_closed = true;
        wsi_mirror = NULL;
        Context = NULL;
        mirror_lifetime = 0;
@@ -94,7 +94,7 @@ Channel::Channel(Service *service1, string uri1) {
        clientisHost = false;
        //isWrite = false;
        //buflen = 0;
-       was_closed = 1;
+       was_closed = true;
        wsi_mirror = NULL;
        Context = NULL;
        mirror_lifetime = 0;
@@ -639,7 +639,7 @@ void Channel::disconnect(Result_Base *result1) {
 
                connectionHandler->stopPing();
 
-               was_closed = 1;
+               was_closed = true;
                lws_callback_on_writable(wsi_mirror);
 
                disconnecting = false;
@@ -734,7 +734,10 @@ void Channel::handleSocketClosed() {
        connectionHandler->stopPing();
        wsi_mirror = NULL;
        connected = false;
-       was_closed = 1;
+       was_closed = true;
+       if ( Context )
+               lws_cancel_service(Context);
+
        if (disconnecting)
                disconnecting = false;
        callbacks.clear();
@@ -908,6 +911,9 @@ int Channel::callback_lws_mirror(struct lws *wsi,
                this_ptr->handleWsiDestroy();
                break;
 
+       case LWS_CALLBACK_GET_THREAD_ID:
+        return pthread_self();
+
        case LWS_CALLBACK_CLIENT_CONFIRM_EXTENSION_SUPPORTED:
        case LWS_CALLBACK_ADD_POLL_FD:
        case LWS_CALLBACK_DEL_POLL_FD:
@@ -1232,7 +1238,7 @@ void Channel::create_websocket(void *att) {
        map<string, string> *attributes = (map<string, string> *)(att);
        string uri = getChannelUri(attributes);
 
-       was_closed = 0;
+       was_closed = false;
        //struct lws_context *context;
 
        int ietf_version = -1; /* latest */
@@ -1312,7 +1318,7 @@ void Channel::create_websocket(void *att) {
                        }
                }
 
-               n = lws_service(Context, 1500);
+               n = lws_service(Context, 0x0FFFFFFF);
 
                if (n < 0)
                        break;
@@ -1600,6 +1606,9 @@ void Channel::handleWsiDestroy()
 {
        if (!isCommunicated) {
                was_closed = true;
+               if ( Context )
+                       lws_cancel_service(Context);
+
                MSF_ERR("wsi destroyed with no communication");
                if (onErrorListener) {
                        onErrorListener->onError();