compiler warning fixes
This commit is contained in:
parent
dc77d62a5d
commit
e85f975ab0
@ -1,6 +1,10 @@
|
||||
# Changelog
|
||||
All changes to this project will be documented in this file.
|
||||
|
||||
## [10.0.3] - 2020-07-28
|
||||
|
||||
compiler warning fixes
|
||||
|
||||
## [10.0.2] - 2020-07-28
|
||||
|
||||
(ixcobra) CobraConnection: unsubscribe from all subscriptions when disconnecting
|
||||
|
@ -19,7 +19,6 @@ namespace snake
|
||||
{
|
||||
void handleError(const std::string& action,
|
||||
ix::WebSocket& ws,
|
||||
const nlohmann::json& pdu,
|
||||
uint64_t pduId,
|
||||
const std::string& errMsg)
|
||||
{
|
||||
@ -116,7 +115,7 @@ namespace snake
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Missing channels or channel field in publish data";
|
||||
handleError("rtm/publish", ws, pdu, pduId, ss.str());
|
||||
handleError("rtm/publish", ws, pduId, ss.str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -136,7 +135,7 @@ namespace snake
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Cannot publish to redis host " << errMsg;
|
||||
handleError("rtm/publish", ws, pdu, pduId, ss.str());
|
||||
handleError("rtm/publish", ws, pduId, ss.str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -175,7 +174,7 @@ namespace snake
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Cannot connect to redis host " << hostname << ":" << port;
|
||||
handleError("rtm/subscribe", ws, pdu, pduId, ss.str());
|
||||
handleError("rtm/subscribe", ws, pduId, ss.str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -187,7 +186,7 @@ namespace snake
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Cannot authenticated to redis";
|
||||
handleError("rtm/subscribe", ws, pdu, pduId, ss.str());
|
||||
handleError("rtm/subscribe", ws, pduId, ss.str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -236,7 +235,7 @@ namespace snake
|
||||
ix::CoreLogger::log(ss.str().c_str());
|
||||
}
|
||||
|
||||
auto subscription = [&redisClient, state, &ws, &pdu, pduId]
|
||||
auto subscription = [&redisClient, state, &ws, pduId]
|
||||
{
|
||||
if (!redisClient.subscribe(state->appChannel,
|
||||
state->onRedisSubscribeResponseCallback,
|
||||
@ -244,7 +243,7 @@ namespace snake
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Error subscribing to channel " << state->appChannel;
|
||||
handleError("rtm/subscribe", ws, pdu, pduId, ss.str());
|
||||
handleError("rtm/subscribe", ws, pduId, ss.str());
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -43,7 +43,7 @@ namespace ix
|
||||
const std::string& hostname,
|
||||
const ix::SocketTLSOptions& tlsOptions,
|
||||
const std::string& remoteUrl,
|
||||
bool verbose)
|
||||
bool /*verbose*/)
|
||||
{
|
||||
ix::WebSocketServer server(port, hostname);
|
||||
server.setTLSOptions(tlsOptions);
|
||||
@ -53,16 +53,15 @@ namespace ix
|
||||
};
|
||||
server.setConnectionStateFactory(factory);
|
||||
|
||||
server.setOnConnectionCallback([remoteUrl,
|
||||
verbose](std::weak_ptr<ix::WebSocket> webSocket,
|
||||
std::shared_ptr<ConnectionState> connectionState,
|
||||
std::unique_ptr<ConnectionInfo> connectionInfo) {
|
||||
server.setOnConnectionCallback([remoteUrl](std::weak_ptr<ix::WebSocket> webSocket,
|
||||
std::shared_ptr<ConnectionState> connectionState,
|
||||
std::unique_ptr<ConnectionInfo> connectionInfo) {
|
||||
auto state = std::dynamic_pointer_cast<ProxyConnectionState>(connectionState);
|
||||
auto remoteIp = connectionInfo->remoteIp;
|
||||
|
||||
// Server connection
|
||||
state->webSocket().setOnMessageCallback(
|
||||
[webSocket, state, remoteIp, verbose](const WebSocketMessagePtr& msg) {
|
||||
[webSocket, state, remoteIp](const WebSocketMessagePtr& msg) {
|
||||
if (msg->type == ix::WebSocketMessageType::Close)
|
||||
{
|
||||
state->setTerminated();
|
||||
@ -81,33 +80,32 @@ namespace ix
|
||||
auto ws = webSocket.lock();
|
||||
if (ws)
|
||||
{
|
||||
ws->setOnMessageCallback(
|
||||
[state, remoteUrl, verbose](const WebSocketMessagePtr& msg) {
|
||||
if (msg->type == ix::WebSocketMessageType::Open)
|
||||
{
|
||||
// Connect to the 'real' server
|
||||
std::string url(remoteUrl);
|
||||
url += msg->openInfo.uri;
|
||||
state->webSocket().setUrl(url);
|
||||
state->webSocket().disableAutomaticReconnection();
|
||||
state->webSocket().start();
|
||||
ws->setOnMessageCallback([state, remoteUrl](const WebSocketMessagePtr& msg) {
|
||||
if (msg->type == ix::WebSocketMessageType::Open)
|
||||
{
|
||||
// Connect to the 'real' server
|
||||
std::string url(remoteUrl);
|
||||
url += msg->openInfo.uri;
|
||||
state->webSocket().setUrl(url);
|
||||
state->webSocket().disableAutomaticReconnection();
|
||||
state->webSocket().start();
|
||||
|
||||
// we should sleep here for a bit until we've established the
|
||||
// connection with the remote server
|
||||
while (state->webSocket().getReadyState() != ReadyState::Open)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
}
|
||||
else if (msg->type == ix::WebSocketMessageType::Close)
|
||||
// we should sleep here for a bit until we've established the
|
||||
// connection with the remote server
|
||||
while (state->webSocket().getReadyState() != ReadyState::Open)
|
||||
{
|
||||
state->webSocket().close(msg->closeInfo.code, msg->closeInfo.reason);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
else if (msg->type == ix::WebSocketMessageType::Message)
|
||||
{
|
||||
state->webSocket().send(msg->str, msg->binary);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (msg->type == ix::WebSocketMessageType::Close)
|
||||
{
|
||||
state->webSocket().close(msg->closeInfo.code, msg->closeInfo.reason);
|
||||
}
|
||||
else if (msg->type == ix::WebSocketMessageType::Message)
|
||||
{
|
||||
state->webSocket().send(msg->str, msg->binary);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -6,4 +6,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define IX_WEBSOCKET_VERSION "10.0.2"
|
||||
#define IX_WEBSOCKET_VERSION "10.0.3"
|
||||
|
@ -85,7 +85,7 @@ namespace ix
|
||||
bool startWebSocketEchoServer(ix::WebSocketServer& server)
|
||||
{
|
||||
server.setOnClientMessageCallback(
|
||||
[&server](std::shared_ptr<ConnectionState> connectionState,
|
||||
[&server](std::shared_ptr<ConnectionState> /*connectionState*/,
|
||||
ConnectionInfo& connectionInfo,
|
||||
WebSocket& webSocket,
|
||||
const ix::WebSocketMessagePtr& msg) {
|
||||
|
@ -169,12 +169,11 @@ namespace
|
||||
{
|
||||
// A dev/null server
|
||||
server.setOnClientMessageCallback(
|
||||
[&receivedCloseCode, &receivedCloseReason, &receivedCloseRemote, &mutexWrite
|
||||
|
||||
](std::shared_ptr<ConnectionState> connectionState,
|
||||
ConnectionInfo& connectionInfo,
|
||||
WebSocket& webSocket,
|
||||
const ix::WebSocketMessagePtr& msg) {
|
||||
[&receivedCloseCode, &receivedCloseReason, &receivedCloseRemote, &mutexWrite](
|
||||
std::shared_ptr<ConnectionState> connectionState,
|
||||
ConnectionInfo& connectionInfo,
|
||||
WebSocket& /*webSocket*/,
|
||||
const ix::WebSocketMessagePtr& msg) {
|
||||
auto remoteIp = connectionInfo.remoteIp;
|
||||
if (msg->type == ix::WebSocketMessageType::Open)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user