Formating
This commit is contained in:
@@ -27,6 +27,7 @@ namespace gaconnector
|
||||
class Websocket
|
||||
{
|
||||
private:
|
||||
bool isLoggedIn = false;
|
||||
char lastPath[513] = "";
|
||||
char lastHash[2 * MD5LEN + 1] = "";
|
||||
ix::WebSocket *webSocket = nullptr;
|
||||
|
||||
+19
-14
@@ -41,44 +41,49 @@ namespace gaconnector
|
||||
if (msg->type == ix::WebSocketMessageType::Open) {
|
||||
std::stringstream debug_msg;
|
||||
|
||||
debug_msg << std::endl << "New connection" << std::endl;
|
||||
debug_msg << "Uri: " << msg->openInfo.uri << std::endl;
|
||||
debug_msg << "Headers:" << std::endl;
|
||||
debug_msg << "New connection" << std::endl;
|
||||
debug_msg << "\tUri: " << msg->openInfo.uri << std::endl;
|
||||
debug_msg << "\tHeaders:" << std::endl;
|
||||
for (const auto &it : msg->openInfo.headers) {
|
||||
debug_msg << it.first << ": " << it.second << std::endl;
|
||||
debug_msg << "\t\t" << it.first << ": " << it.second << std::endl;
|
||||
}
|
||||
|
||||
this->toLog(debug_msg.str());
|
||||
|
||||
this->webSocket->send("MASTER:" + user);
|
||||
this->toLog("Connecting as " + user);
|
||||
this->isLoggedIn = true;
|
||||
} else if (msg->type == ix::WebSocketMessageType::Close) {
|
||||
if (msg->closeInfo.reason.compare("DUPLICATE") == 0) {
|
||||
this->webSocket->disableAutomaticReconnection();
|
||||
|
||||
this->toLog("Disconnected due to beeing a duplicate simualtor");
|
||||
this->isLoggedIn = false;
|
||||
} else {
|
||||
std::stringstream debug_msg;
|
||||
|
||||
debug_msg << std::endl << "Connection closed" << std::endl;
|
||||
debug_msg << "Code: " << msg->closeInfo.code << std::endl;
|
||||
debug_msg << "Reason: " << msg->closeInfo.reason << std::endl;
|
||||
debug_msg << "Remote: " << msg->closeInfo.remote << std::endl;
|
||||
debug_msg << "Connection closed" << std::endl;
|
||||
debug_msg << "\tCode: " << msg->closeInfo.code << std::endl;
|
||||
debug_msg << "\tReason: " << msg->closeInfo.reason << std::endl;
|
||||
debug_msg << "\tRemote: " << msg->closeInfo.remote << std::endl;
|
||||
|
||||
this->toLog(debug_msg.str());
|
||||
this->isLoggedIn = false;
|
||||
}
|
||||
} else if (msg->type == ix::WebSocketMessageType::Error) {
|
||||
std::stringstream debug_msg;
|
||||
|
||||
debug_msg << std::endl << "Connection error" << std::endl;
|
||||
debug_msg << "Decompression: " << msg->errorInfo.decompressionError
|
||||
debug_msg << "Connection error" << std::endl;
|
||||
debug_msg << "\tDecompression: " << msg->errorInfo.decompressionError
|
||||
<< std::endl;
|
||||
debug_msg << "HTTP status: " << msg->errorInfo.http_status << std::endl;
|
||||
debug_msg << "Reason: " << msg->errorInfo.reason << std::endl;
|
||||
debug_msg << "Retries: " << msg->errorInfo.retries << std::endl;
|
||||
debug_msg << "Wait time: " << msg->errorInfo.wait_time << std::endl;
|
||||
debug_msg << "\tHTTP status: " << msg->errorInfo.http_status
|
||||
<< std::endl;
|
||||
debug_msg << "\tReason: " << msg->errorInfo.reason << std::endl;
|
||||
debug_msg << "\tRetries: " << msg->errorInfo.retries << std::endl;
|
||||
debug_msg << "\tWait time: " << msg->errorInfo.wait_time << std::endl;
|
||||
|
||||
this->toLog(debug_msg.str());
|
||||
this->isLoggedIn = false;
|
||||
} else if (msg->type == ix::WebSocketMessageType::Message) {
|
||||
if (!msg->str.empty()) {
|
||||
this->toLog(msg->str);
|
||||
|
||||
Reference in New Issue
Block a user