From ccfd196863273197395c22c568af04815b58b104 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Thu, 16 Apr 2020 11:58:06 -0700 Subject: [PATCH] clang-format --- ixwebsocket/IXWebSocketOpenInfo.h | 2 +- ixwebsocket/IXWebSocketTransport.cpp | 3 +- test/IXCobraChatTest.cpp | 3 +- test/IXCobraMetricsPublisherTest.cpp | 3 +- ws/ws_cobra_metrics_to_redis.cpp | 3 +- ws/ws_cobra_publish.cpp | 104 +++++++++++++-------------- ws/ws_cobra_subscribe.cpp | 3 +- 7 files changed, 59 insertions(+), 62 deletions(-) diff --git a/ixwebsocket/IXWebSocketOpenInfo.h b/ixwebsocket/IXWebSocketOpenInfo.h index 37bff41e..3eb32b0b 100644 --- a/ixwebsocket/IXWebSocketOpenInfo.h +++ b/ixwebsocket/IXWebSocketOpenInfo.h @@ -6,9 +6,9 @@ #pragma once +#include "IXWebSocketHttpHeaders.h" #include #include -#include "IXWebSocketHttpHeaders.h" namespace ix { diff --git a/ixwebsocket/IXWebSocketTransport.cpp b/ixwebsocket/IXWebSocketTransport.cpp index 45a51015..ff72b886 100644 --- a/ixwebsocket/IXWebSocketTransport.cpp +++ b/ixwebsocket/IXWebSocketTransport.cpp @@ -222,7 +222,8 @@ namespace ix { _pongReceived = false; std::stringstream ss; - ss << kPingMessage << "::" << _pingIntervalSecs << "s" << "::" << _pingCount++; + ss << kPingMessage << "::" << _pingIntervalSecs << "s" + << "::" << _pingCount++; return sendPing(ss.str()); } diff --git a/test/IXCobraChatTest.cpp b/test/IXCobraChatTest.cpp index e673a350..6ffbd80f 100644 --- a/test/IXCobraChatTest.cpp +++ b/test/IXCobraChatTest.cpp @@ -180,8 +180,7 @@ namespace _conn.configure(_cobraConfig); _conn.connect(); - _conn.setEventCallback([this, channel](const CobraEventPtr& event) - { + _conn.setEventCallback([this, channel](const CobraEventPtr& event) { if (event->type == ix::CobraEventType::Open) { log("Subscriber connected: " + _user); diff --git a/test/IXCobraMetricsPublisherTest.cpp b/test/IXCobraMetricsPublisherTest.cpp index 4512b3ae..10653bd3 100644 --- a/test/IXCobraMetricsPublisherTest.cpp +++ b/test/IXCobraMetricsPublisherTest.cpp @@ -54,8 +54,7 @@ namespace conn.configure(config); conn.connect(); - conn.setEventCallback([&conn, &channel](const CobraEventPtr& event) - { + conn.setEventCallback([&conn, &channel](const CobraEventPtr& event) { if (event->type == ix::CobraEventType::Open) { TLogger() << "Subscriber connected:"; diff --git a/ws/ws_cobra_metrics_to_redis.cpp b/ws/ws_cobra_metrics_to_redis.cpp index 7cb9d386..1a61876d 100644 --- a/ws/ws_cobra_metrics_to_redis.cpp +++ b/ws/ws_cobra_metrics_to_redis.cpp @@ -106,8 +106,7 @@ namespace ix &msgPerSeconds, &conditionVariableMutex, &condition, - &queue](const CobraEventPtr& event) - { + &queue](const CobraEventPtr& event) { if (event->type == ix::CobraEventType::Open) { spdlog::info("Subscriber connected"); diff --git a/ws/ws_cobra_publish.cpp b/ws/ws_cobra_publish.cpp index f7ac44b2..b1d3b5b6 100644 --- a/ws/ws_cobra_publish.cpp +++ b/ws/ws_cobra_publish.cpp @@ -38,62 +38,62 @@ namespace ix std::atomic authenticated(false); std::atomic messageAcked(false); - conn.setEventCallback([&conn, &channel, &data, &authenticated, &messageAcked](const CobraEventPtr& event) - { - if (event->type == ix::CobraEventType::Open) - { - spdlog::info("Publisher connected"); - - for (auto&& it : event->headers) + conn.setEventCallback( + [&conn, &channel, &data, &authenticated, &messageAcked](const CobraEventPtr& event) { + if (event->type == ix::CobraEventType::Open) { - spdlog::info("{}: {}", it.first, it.second); + spdlog::info("Publisher connected"); + + for (auto&& it : event->headers) + { + spdlog::info("{}: {}", it.first, it.second); + } } - } - else if (event->type == ix::CobraEventType::Closed) - { - spdlog::info("Subscriber closed: {}", event->errMsg); - } - else if (event->type == ix::CobraEventType::Authenticated) - { - spdlog::info("Publisher authenticated"); - authenticated = true; + else if (event->type == ix::CobraEventType::Closed) + { + spdlog::info("Subscriber closed: {}", event->errMsg); + } + else if (event->type == ix::CobraEventType::Authenticated) + { + spdlog::info("Publisher authenticated"); + authenticated = true; - Json::Value channels; - channels[0] = channel; - auto msgId = conn.publish(channels, data); + Json::Value channels; + channels[0] = channel; + auto msgId = conn.publish(channels, data); - spdlog::info("Published msg {}", msgId); - } - else if (event->type == ix::CobraEventType::Subscribed) - { - spdlog::info("Publisher: subscribed to channel {}", event->subscriptionId); - } - else if (event->type == ix::CobraEventType::UnSubscribed) - { - spdlog::info("Publisher: unsubscribed from channel {}", event->subscriptionId); - } - else if (event->type == ix::CobraEventType::Error) - { - spdlog::error("Publisher: error {}", event->errMsg); - } - else if (event->type == ix::CobraEventType::Published) - { - spdlog::info("Published message id {} acked", event->msgId); - messageAcked = true; - } - else if (event->type == ix::CobraEventType::Pong) - { - spdlog::info("Received websocket pong"); - } - else if (event->type == ix::CobraEventType::HandshakeError) - { - spdlog::error("Subscriber: Handshake error: {}", event->errMsg); - } - else if (event->type == ix::CobraEventType::AuthenticationError) - { - spdlog::error("Subscriber: Authentication error: {}", event->errMsg); - } - }); + spdlog::info("Published msg {}", msgId); + } + else if (event->type == ix::CobraEventType::Subscribed) + { + spdlog::info("Publisher: subscribed to channel {}", event->subscriptionId); + } + else if (event->type == ix::CobraEventType::UnSubscribed) + { + spdlog::info("Publisher: unsubscribed from channel {}", event->subscriptionId); + } + else if (event->type == ix::CobraEventType::Error) + { + spdlog::error("Publisher: error {}", event->errMsg); + } + else if (event->type == ix::CobraEventType::Published) + { + spdlog::info("Published message id {} acked", event->msgId); + messageAcked = true; + } + else if (event->type == ix::CobraEventType::Pong) + { + spdlog::info("Received websocket pong"); + } + else if (event->type == ix::CobraEventType::HandshakeError) + { + spdlog::error("Subscriber: Handshake error: {}", event->errMsg); + } + else if (event->type == ix::CobraEventType::AuthenticationError) + { + spdlog::error("Subscriber: Authentication error: {}", event->errMsg); + } + }); conn.connect(); diff --git a/ws/ws_cobra_subscribe.cpp b/ws/ws_cobra_subscribe.cpp index 6c1d840e..ac13197c 100644 --- a/ws/ws_cobra_subscribe.cpp +++ b/ws/ws_cobra_subscribe.cpp @@ -106,8 +106,7 @@ namespace ix &msgPerSeconds, &quiet, &fluentd, - &fatalCobraError](const CobraEventPtr& event) - { + &fatalCobraError](const CobraEventPtr& event) { if (event->type == ix::CobraEventType::Open) { spdlog::info("Subscriber connected");