C++14 + use make_unique and make_shared to make shared pointers

This commit is contained in:
Benjamin Sergeant
2019-01-11 21:25:06 -08:00
parent 7fabd14a63
commit a0f15bfb56
13 changed files with 23 additions and 20 deletions

View File

@ -51,7 +51,7 @@ namespace ix
void WebSocketServer::handleConnection(int fd)
{
std::shared_ptr<WebSocket> webSocket(new WebSocket);
auto webSocket = std::make_shared<WebSocket>();
_onConnectionCallback(webSocket);
webSocket->disableAutomaticReconnection();
@ -99,6 +99,7 @@ namespace ix
size_t WebSocketServer::getConnectedClientsCount()
{
return getClients().size();
std::lock_guard<std::mutex> lock(_clientsMutex);
return _clients.size();
}
}