(ixcobra) make CobraConnection_EventType an enum class (CobraEventType)

This commit is contained in:
Benjamin Sergeant
2020-04-15 16:59:17 -07:00
parent 2c4bf8f4bd
commit 386ef3ab04
14 changed files with 122 additions and 105 deletions

View File

@ -106,12 +106,12 @@ namespace ix
&msgPerSeconds,
&conditionVariableMutex,
&condition,
&queue](ix::CobraConnectionEventType eventType,
&queue](ix::CobraEventType eventType,
const std::string& errMsg,
const ix::WebSocketHttpHeaders& headers,
const std::string& subscriptionId,
CobraConnection::MsgId msgId) {
if (eventType == ix::CobraConnection_EventType_Open)
if (eventType == ix::CobraEventType::Open)
{
spdlog::info("Subscriber connected");
@ -120,7 +120,7 @@ namespace ix
spdlog::info("{}: {}", it.first, it.second);
}
}
else if (eventType == ix::CobraConnection_EventType_Authenticated)
else if (eventType == ix::CobraEventType::Authenticated)
{
spdlog::info("Subscriber authenticated");
@ -141,19 +141,19 @@ namespace ix
msgCount++;
});
}
else if (eventType == ix::CobraConnection_EventType_Subscribed)
else if (eventType == ix::CobraEventType::Subscribed)
{
spdlog::info("Subscriber: subscribed to channel {}", subscriptionId);
}
else if (eventType == ix::CobraConnection_EventType_UnSubscribed)
else if (eventType == ix::CobraEventType::UnSubscribed)
{
spdlog::info("Subscriber: unsubscribed from channel {}", subscriptionId);
}
else if (eventType == ix::CobraConnection_EventType_Error)
else if (eventType == ix::CobraEventType::Error)
{
spdlog::error("Subscriber: error {}", errMsg);
}
else if (eventType == ix::CobraConnection_EventType_Published)
else if (eventType == ix::CobraEventType::Published)
{
spdlog::error("Published message hacked: {}", msgId);
}

View File

@ -39,12 +39,12 @@ namespace ix
std::atomic<bool> messageAcked(false);
conn.setEventCallback([&conn, &channel, &data, &authenticated, &messageAcked](
ix::CobraConnectionEventType eventType,
ix::CobraEventType eventType,
const std::string& errMsg,
const ix::WebSocketHttpHeaders& headers,
const std::string& subscriptionId,
CobraConnection::MsgId msgId) {
if (eventType == ix::CobraConnection_EventType_Open)
if (eventType == ix::CobraEventType::Open)
{
spdlog::info("Publisher connected");
@ -53,7 +53,7 @@ namespace ix
spdlog::info("{}: {}", it.first, it.second);
}
}
else if (eventType == ix::CobraConnection_EventType_Authenticated)
else if (eventType == ix::CobraEventType::Authenticated)
{
spdlog::info("Publisher authenticated");
authenticated = true;
@ -64,24 +64,24 @@ namespace ix
spdlog::info("Published msg {}", msgId);
}
else if (eventType == ix::CobraConnection_EventType_Subscribed)
else if (eventType == ix::CobraEventType::Subscribed)
{
spdlog::info("Publisher: subscribed to channel {}", subscriptionId);
}
else if (eventType == ix::CobraConnection_EventType_UnSubscribed)
else if (eventType == ix::CobraEventType::UnSubscribed)
{
spdlog::info("Publisher: unsubscribed from channel {}", subscriptionId);
}
else if (eventType == ix::CobraConnection_EventType_Error)
else if (eventType == ix::CobraEventType::Error)
{
spdlog::error("Publisher: error {}", errMsg);
}
else if (eventType == ix::CobraConnection_EventType_Published)
else if (eventType == ix::CobraEventType::Published)
{
spdlog::info("Published message id {} acked", msgId);
messageAcked = true;
}
else if (eventType == ix::CobraConnection_EventType_Pong)
else if (eventType == ix::CobraEventType::Pong)
{
spdlog::info("Received websocket pong");
}

View File

@ -106,12 +106,12 @@ namespace ix
&msgPerSeconds,
&quiet,
&fluentd,
&fatalCobraError](ix::CobraConnectionEventType eventType,
&fatalCobraError](ix::CobraEventType eventType,
const std::string& errMsg,
const ix::WebSocketHttpHeaders& headers,
const std::string& subscriptionId,
CobraConnection::MsgId msgId) {
if (eventType == ix::CobraConnection_EventType_Open)
if (eventType == ix::CobraEventType::Open)
{
spdlog::info("Subscriber connected");
@ -120,7 +120,7 @@ namespace ix
spdlog::info("{}: {}", it.first, it.second);
}
}
else if (eventType == ix::CobraConnection_EventType_Authenticated)
else if (eventType == ix::CobraEventType::Authenticated)
{
spdlog::info("Subscriber authenticated");
spdlog::info("Subscribing to {} at position {}", channel, subscriptionPosition);
@ -145,37 +145,37 @@ namespace ix
subscriptionPosition = position;
});
}
else if (eventType == ix::CobraConnection_EventType_Subscribed)
else if (eventType == ix::CobraEventType::Subscribed)
{
spdlog::info("Subscriber: subscribed to channel {}", subscriptionId);
}
else if (eventType == ix::CobraConnection_EventType_UnSubscribed)
else if (eventType == ix::CobraEventType::UnSubscribed)
{
spdlog::info("Subscriber: unsubscribed from channel {}", subscriptionId);
}
else if (eventType == ix::CobraConnection_EventType_Error)
else if (eventType == ix::CobraEventType::Error)
{
spdlog::error("Subscriber: error {}", errMsg);
}
else if (eventType == ix::CobraConnection_EventType_Published)
else if (eventType == ix::CobraEventType::Published)
{
spdlog::error("Published message hacked: {}", msgId);
}
else if (eventType == ix::CobraConnection_EventType_Pong)
else if (eventType == ix::CobraEventType::Pong)
{
spdlog::info("Received websocket pong");
}
else if (eventType == ix::CobraConnection_EventType_Handshake_Error)
else if (eventType == ix::CobraEventType::HandshakeError)
{
spdlog::error("Subscriber: Handshake error: {}", errMsg);
fatalCobraError = true;
}
else if (eventType == ix::CobraConnection_EventType_Authentication_Error)
else if (eventType == ix::CobraEventType::AuthenticationError)
{
spdlog::error("Subscriber: Authentication error: {}", errMsg);
fatalCobraError = true;
}
else if (eventType == ix::CobraConnection_EventType_Subscription_Error)
else if (eventType == ix::CobraEventType::SubscriptionError)
{
spdlog::error("Subscriber: Subscription error: {}", errMsg);
fatalCobraError = true;