mirror of https://github.com/axmolengine/axmol.git
Update WebSocket.cpp
bufix: when connecting fail, libwebsocket_client_connect() will return NULL, and onSocketCallback() will not be called, so we need trigger WS_MSG_TO_UITHREAD_ERROR here.
This commit is contained in:
parent
603df24d0e
commit
d8b1f78039
|
@ -442,6 +442,14 @@ void WebSocket::onSubThreadStarted()
|
|||
_wsInstance = libwebsocket_client_connect(_wsContext, _host.c_str(), _port, _SSLConnection,
|
||||
_path.c_str(), _host.c_str(), _host.c_str(),
|
||||
name.c_str(), -1);
|
||||
|
||||
if(NULL == _wsInstance) {
|
||||
WsMessage* msg = new WsMessage();
|
||||
msg->what = WS_MSG_TO_UITHREAD_ERROR;
|
||||
_readyState = kStateClosing;
|
||||
_wsHelper->sendMessageToUIThread(msg);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue