add cancellation support while connecting, to speed up WebSocket::stop

This commit is contained in:
Benjamin Sergeant
2018-12-09 17:56:20 -08:00
parent 62528e6a0b
commit 8c079787f0
13 changed files with 69 additions and 25 deletions

View File

@ -7,7 +7,6 @@
*/
#include "IXSocketOpenSSL.h"
#include "IXSocketConnect.h"
#include <cassert>
#include <iostream>
@ -275,7 +274,8 @@ namespace ix
// No wait support
bool SocketOpenSSL::connect(const std::string& host,
int port,
std::string& errMsg)
std::string& errMsg,
CancellationRequest isCancellationRequested)
{
bool handshakeSuccessful = false;
{
@ -286,7 +286,7 @@ namespace ix
return false;
}
_sockfd = SocketConnect::connect(host, port, errMsg);
_sockfd = SocketConnect::connect(host, port, errMsg, isCancellationRequested);
if (_sockfd == -1) return false;
_ssl_context = openSSLCreateContext(errMsg);