mirror of https://github.com/axmolengine/axmol.git
Merge pull request #14079 from ZeroHackeR/v3
Fixing SocketIO - Connect failed after Disconnected
This commit is contained in:
commit
255edd5b46
|
@ -1199,6 +1199,23 @@ SIOClient* SocketIO::connect(const std::string& uri, SocketIO::SIODelegate& dele
|
||||||
socket->addClient(path, c);
|
socket->addClient(path, c);
|
||||||
|
|
||||||
socket->connectToEndpoint(path);
|
socket->connectToEndpoint(path);
|
||||||
|
}else{
|
||||||
|
CCLOG("SocketIO: disconnect previous client");
|
||||||
|
c->disconnect();
|
||||||
|
|
||||||
|
CCLOG("SocketIO: recreate a new socket, new client, connect");
|
||||||
|
SIOClientImpl* newSocket = nullptr;
|
||||||
|
SIOClient *newC = nullptr;
|
||||||
|
|
||||||
|
newSocket = SIOClientImpl::create(host, port);
|
||||||
|
|
||||||
|
newC = new (std::nothrow) SIOClient(host, port, path, newSocket, delegate);
|
||||||
|
|
||||||
|
newSocket->addClient(path, newC);
|
||||||
|
|
||||||
|
newSocket->connect();
|
||||||
|
|
||||||
|
return newC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue