Commit 89763279 authored by rkc's avatar rkc Committed by Commit bot

Fix socket send.

Instead of calling CopresenceSocket::Send with the size of the packet we
created, we were calling it with the size of the original data. This CL fixes
that bug and adds more logging when we're sending data.

R=xiyuan@chromium.org
BUG=None.

Review URL: https://codereview.chromium.org/698153005

Cr-Commit-Position: refs/heads/master@{#302656}
parent 743f4ae9
...@@ -269,8 +269,14 @@ ExtensionFunction::ResponseAction CopresenceSocketSendFunction::Execute() { ...@@ -269,8 +269,14 @@ ExtensionFunction::ResponseAction CopresenceSocketSendFunction::Execute() {
core_api::copresence_socket::SOCKET_STATUS_INVALID_SOCKET))); core_api::copresence_socket::SOCKET_STATUS_INVALID_SOCKET)));
} }
socket->socket()->Send(new net::StringIOBuffer(CreateMessage(params->data)), const std::string& message = CreateMessage(params->data);
params->data.size()); VLOG(3) << "Sending message to socket_id = " << params->socket_id
<< " with data[0] = " << static_cast<int>(message[0])
<< ", data[1] = " << static_cast<int>(message[1]) << ", data[2:] = "
<< std::string((message.c_str() + 2), message.size() - 2);
socket->socket()->Send(new net::StringIOBuffer(message), message.size());
return RespondNow( return RespondNow(
ArgumentList(core_api::copresence_socket::Send::Results::Create( ArgumentList(core_api::copresence_socket::Send::Results::Create(
core_api::copresence_socket::SOCKET_STATUS_NO_ERROR))); core_api::copresence_socket::SOCKET_STATUS_NO_ERROR)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment