timeout is configurable

This commit is contained in:
Benjamin Sergeant
2019-01-03 18:33:08 -08:00
parent 3021ac4b95
commit bce5ef2dca
9 changed files with 54 additions and 24 deletions

View File

@ -86,13 +86,14 @@ namespace ix
void setUrl(const std::string& url);
void setPerMessageDeflateOptions(const WebSocketPerMessageDeflateOptions& perMessageDeflateOptions);
void setHandshakeTimeout(int _handshakeTimeoutSecs);
// Run asynchronously, by calling start and stop.
void start();
void stop();
// Run in blocking mode, by connecting first manually, and then calling run.
WebSocketInitResult connect();
WebSocketInitResult connect(int timeoutSecs);
void run();
WebSocketSendInfo send(const std::string& text);
@ -122,7 +123,7 @@ namespace ix
// Server
void setSocketFileDescriptor(int fd);
WebSocketInitResult connectToSocket(int fd);
WebSocketInitResult connectToSocket(int fd, int timeoutSecs);
WebSocketTransport _ws;
@ -138,6 +139,9 @@ namespace ix
std::thread _thread;
std::mutex _writeMutex;
std::atomic<int> _handshakeTimeoutSecs;
static const int kDefaultHandShakeTimeoutSecs;
friend class WebSocketServer;
};
}