mirror of
https://gitee.com/openharmony/communication_netstack
synced 2024-11-27 09:02:33 +00:00
commit
2885cda4c6
@ -44,8 +44,6 @@ private:
|
||||
static bool ParseUrl(ConnectContext *context, char *prefix, size_t prefixLen, char *address, size_t addressLen,
|
||||
char *path, size_t pathLen, int *port);
|
||||
|
||||
static void RunService(EventManager *manager);
|
||||
|
||||
static int RaiseError(EventManager *manager, uint32_t httpResponse);
|
||||
|
||||
static int HttpDummy(lws *wsi, lws_callback_reasons reason, void *user, void *in, size_t len);
|
||||
|
@ -282,19 +282,10 @@ bool WebSocketExec::ParseUrl(ConnectContext *context, char *protocol, size_t pro
|
||||
return true;
|
||||
}
|
||||
|
||||
void WebSocketExec::RunService(EventManager *manager)
|
||||
void RunService(UserData *userData)
|
||||
{
|
||||
NETSTACK_LOGI("websocket run service start");
|
||||
int res = 0;
|
||||
if (!EventManager::IsManagerValid(manager)) {
|
||||
NETSTACK_LOGE("manager is invalid");
|
||||
return;
|
||||
}
|
||||
if (manager == nullptr || manager->GetData() == nullptr) {
|
||||
NETSTACK_LOGE("RunService para error");
|
||||
return;
|
||||
}
|
||||
auto userData = reinterpret_cast<UserData *>(manager->GetData());
|
||||
lws_context *context = userData->GetContext();
|
||||
if (context == nullptr) {
|
||||
NETSTACK_LOGE("context is null");
|
||||
@ -306,7 +297,6 @@ void WebSocketExec::RunService(EventManager *manager)
|
||||
lws_context_destroy(context);
|
||||
userData->SetContext(nullptr);
|
||||
delete userData;
|
||||
manager->SetData(nullptr);
|
||||
NETSTACK_LOGI("websocket run service end");
|
||||
}
|
||||
|
||||
@ -823,7 +813,7 @@ bool WebSocketExec::ExecConnect(ConnectContext *context)
|
||||
delete userData;
|
||||
return false;
|
||||
}
|
||||
std::thread serviceThread(RunService, manager);
|
||||
std::thread serviceThread(RunService, userData);
|
||||
|
||||
#if defined(MAC_PLATFORM) || defined(IOS_PLATFORM)
|
||||
pthread_setname_np(WEBSOCKET_CLIENT_THREAD_RUN);
|
||||
|
Loading…
Reference in New Issue
Block a user