From e85f975ab0e8c954907ab55251762c172407f199 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Tue, 28 Jul 2020 21:46:26 -0700 Subject: [PATCH] compiler warning fixes --- docs/CHANGELOG.md | 4 ++ ixsnake/ixsnake/IXSnakeProtocol.cpp | 13 +++--- ixwebsocket/IXWebSocketProxyServer.cpp | 58 +++++++++++++------------- ixwebsocket/IXWebSocketVersion.h | 2 +- test/IXTest.cpp | 2 +- test/IXWebSocketCloseTest.cpp | 11 +++-- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d29b6cf1..ba18d5f0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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 diff --git a/ixsnake/ixsnake/IXSnakeProtocol.cpp b/ixsnake/ixsnake/IXSnakeProtocol.cpp index d291d012..1422aa6b 100644 --- a/ixsnake/ixsnake/IXSnakeProtocol.cpp +++ b/ixsnake/ixsnake/IXSnakeProtocol.cpp @@ -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; } }; diff --git a/ixwebsocket/IXWebSocketProxyServer.cpp b/ixwebsocket/IXWebSocketProxyServer.cpp index a15e6a4b..140b21ec 100644 --- a/ixwebsocket/IXWebSocketProxyServer.cpp +++ b/ixwebsocket/IXWebSocketProxyServer.cpp @@ -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 webSocket, - std::shared_ptr connectionState, - std::unique_ptr connectionInfo) { + server.setOnConnectionCallback([remoteUrl](std::weak_ptr webSocket, + std::shared_ptr connectionState, + std::unique_ptr connectionInfo) { auto state = std::dynamic_pointer_cast(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); + } + }); } }); diff --git a/ixwebsocket/IXWebSocketVersion.h b/ixwebsocket/IXWebSocketVersion.h index f6486f34..77b5eded 100644 --- a/ixwebsocket/IXWebSocketVersion.h +++ b/ixwebsocket/IXWebSocketVersion.h @@ -6,4 +6,4 @@ #pragma once -#define IX_WEBSOCKET_VERSION "10.0.2" +#define IX_WEBSOCKET_VERSION "10.0.3" diff --git a/test/IXTest.cpp b/test/IXTest.cpp index d6a185ce..3508d10f 100644 --- a/test/IXTest.cpp +++ b/test/IXTest.cpp @@ -85,7 +85,7 @@ namespace ix bool startWebSocketEchoServer(ix::WebSocketServer& server) { server.setOnClientMessageCallback( - [&server](std::shared_ptr connectionState, + [&server](std::shared_ptr /*connectionState*/, ConnectionInfo& connectionInfo, WebSocket& webSocket, const ix::WebSocketMessagePtr& msg) { diff --git a/test/IXWebSocketCloseTest.cpp b/test/IXWebSocketCloseTest.cpp index bdb90934..bf291eb5 100644 --- a/test/IXWebSocketCloseTest.cpp +++ b/test/IXWebSocketCloseTest.cpp @@ -169,12 +169,11 @@ namespace { // A dev/null server server.setOnClientMessageCallback( - [&receivedCloseCode, &receivedCloseReason, &receivedCloseRemote, &mutexWrite - - ](std::shared_ptr connectionState, - ConnectionInfo& connectionInfo, - WebSocket& webSocket, - const ix::WebSocketMessagePtr& msg) { + [&receivedCloseCode, &receivedCloseReason, &receivedCloseRemote, &mutexWrite]( + std::shared_ptr connectionState, + ConnectionInfo& connectionInfo, + WebSocket& /*webSocket*/, + const ix::WebSocketMessagePtr& msg) { auto remoteIp = connectionInfo.remoteIp; if (msg->type == ix::WebSocketMessageType::Open) {