ws transfer + send + receive / improved logging (contributed by Matt DeBoer)
This commit is contained in:
@ -67,7 +67,7 @@ namespace ix
|
||||
|
||||
void WebSocketSender::waitForConnection()
|
||||
{
|
||||
std::cout << "Connecting..." << std::endl;
|
||||
std::cout << "ws_send: Connecting..." << std::endl;
|
||||
|
||||
std::unique_lock<std::mutex> lock(_conditionVariableMutex);
|
||||
_condition.wait(lock);
|
||||
@ -75,7 +75,7 @@ namespace ix
|
||||
|
||||
void WebSocketSender::waitForAck()
|
||||
{
|
||||
std::cout << "Waiting for ack..." << std::endl;
|
||||
std::cout << "ws_send: Waiting for ack..." << std::endl;
|
||||
|
||||
std::unique_lock<std::mutex> lock(_conditionVariableMutex);
|
||||
_condition.wait(lock);
|
||||
@ -107,7 +107,7 @@ namespace ix
|
||||
_webSocket.setPerMessageDeflateOptions(webSocketPerMessageDeflateOptions);
|
||||
|
||||
std::stringstream ss;
|
||||
log(std::string("Connecting to url: ") + _url);
|
||||
log(std::string("ws_send: Connecting to url: ") + _url);
|
||||
|
||||
_webSocket.setOnMessageCallback([this](const WebSocketMessagePtr& msg) {
|
||||
std::stringstream ss;
|
||||
@ -162,7 +162,7 @@ namespace ix
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << "Invalid ix::WebSocketMessageType";
|
||||
ss << "ws_send: Invalid ix::WebSocketMessageType";
|
||||
log(ss.str());
|
||||
}
|
||||
});
|
||||
@ -258,7 +258,7 @@ namespace ix
|
||||
auto duration = bench.getDuration();
|
||||
auto transferRate = 1000 * content.size() / duration;
|
||||
transferRate /= (1024 * 1024);
|
||||
std::cout << "Send transfer rate: " << transferRate << "MB/s" << std::endl;
|
||||
std::cout << "ws_send: Send transfer rate: " << transferRate << "MB/s" << std::endl;
|
||||
}
|
||||
|
||||
void wsSend(const std::string& url,
|
||||
@ -271,12 +271,12 @@ namespace ix
|
||||
|
||||
webSocketSender.waitForConnection();
|
||||
|
||||
std::cout << "Sending..." << std::endl;
|
||||
std::cout << "ws_send: Sending..." << std::endl;
|
||||
webSocketSender.sendMessage(path, throttle);
|
||||
|
||||
webSocketSender.waitForAck();
|
||||
|
||||
std::cout << "Done !" << std::endl;
|
||||
std::cout << "ws_send: Done !" << std::endl;
|
||||
webSocketSender.stop();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user