Converting logging to ASCII and other Windows fixes.

This commit is contained in:
Ben Vanik
2013-02-09 08:05:39 -08:00
parent fa16593ab6
commit 3cae7ed714
37 changed files with 213 additions and 192 deletions

View File

@@ -67,11 +67,11 @@ int Debugger::Startup() {
// If desired, wait until the first client connects.
if (FLAGS_wait_for_debugger) {
XELOGI(XT("Waiting for debugger on port %d..."), FLAGS_remote_debug_port);
XELOGI("Waiting for debugger on port %d...", FLAGS_remote_debug_port);
if (listener_->WaitForClient()) {
return 1;
}
XELOGI(XT("Debugger attached, continuing..."));
XELOGI("Debugger attached, continuing...");
}
return 0;
@@ -123,7 +123,7 @@ int Debugger::Dispatch(Client* client, const uint8_t* data, size_t length) {
std::map<uint32_t, ContentSource*>::iterator it =
content_sources_.find(source_id);
if (it == content_sources_.end()) {
XELOGW(XT("Content source %d not found, ignoring message"), source_id);
XELOGW("Content source %d not found, ignoring message", source_id);
return 1;
}
return it->second->Dispatch(client, type, request_id, data + 16, size);

View File

@@ -126,7 +126,7 @@ void WsClientOnMsgCallback(wslay_event_context_ptr ctx,
WsClient* client = reinterpret_cast<WsClient*>(user_data);
switch (arg->opcode) {
case WSLAY_TEXT_FRAME:
XELOGW(XT("Text frame ignored; use binary messages"));
XELOGW("Text frame ignored; use binary messages");
break;
case WSLAY_BINARY_FRAME:
client->OnMessage(arg->msg, arg->msg_length);
@@ -184,24 +184,24 @@ int WsClient::PerformHandshake() {
}
break;
} else {
XELOGE(XT("HTTP header read failure"));
XELOGE("HTTP header read failure");
return 1;
}
} else if (r == 0) {
// EOF.
XELOGE(XT("HTTP header EOF"));
XELOGE("HTTP header EOF");
return 2;
} else {
headers.append(buffer, buffer + r);
if (headers.size() > 8192) {
XELOGE(XT("HTTP headers exceeded max buffer size"));
XELOGE("HTTP headers exceeded max buffer size");
return 3;
}
}
}
if (headers.find("\r\n\r\n") == std::string::npos) {
XELOGE(XT("Incomplete HTTP headers: %s"), headers.c_str());
XELOGE("Incomplete HTTP headers: %s", headers.c_str());
return 1;
}
@@ -211,7 +211,7 @@ int WsClient::PerformHandshake() {
headers.find("Connection: Upgrade\r\n") == std::string::npos ||
(keyhdstart = headers.find("Sec-WebSocket-Key: ")) ==
std::string::npos) {
XELOGW(XT("HTTP connection does not contain websocket headers"));
XELOGW("HTTP connection does not contain websocket headers");
return 2;
}
keyhdstart += 19;
@@ -240,7 +240,7 @@ int WsClient::PerformHandshake() {
if (error_code == EAGAIN || error_code == EWOULDBLOCK) {
break;
} else {
XELOGE(XT("HTTP response write failure"));
XELOGE("HTTP response write failure");
return 4;
}
} else {
@@ -305,7 +305,7 @@ void WsClient::EventThread() {
if ((xe_socket_loop_check_socket_recv(loop_) && wslay_event_recv(ctx)) ||
(xe_socket_loop_check_socket_send(loop_) && wslay_event_send(ctx))) {
// Error handling the event.
XELOGE(XT("Error handling WebSocket data"));
XELOGE("Error handling WebSocket data");
break;
}
}

View File

@@ -41,7 +41,7 @@ int WsListener::Setup() {
xe_socket_set_nodelay(socket_id_, true);
if (xe_socket_bind(socket_id_, port_)) {
XELOGE(XT("Could not bind listen socket: %d"), errno);
XELOGE("Could not bind listen socket: %d", errno);
return 1;
}
@@ -60,7 +60,7 @@ int WsListener::WaitForClient() {
return 1;
}
XELOGI(XT("Debugger connected from %s"), client_info.addr);
XELOGI("Debugger connected from %s", client_info.addr);
// Create the client object.
// Note that the client will delete itself when done.