Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc

Issue 304373008: Add support for modifying TCP and UDP socket buffer size in nacl_io (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: in socket_test.cc, change accept() to ki_accept() per review comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | native_client_sdk/src/libraries/nacl_io/socket/udp_node.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc b/native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc
index 06e45e67ecd09a25036173805f9a4d986b8aaa5a..93fb7dd41d82e25c4e1ab91f58ebb87fc1270d7c 100644
--- a/native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc
@@ -350,6 +350,28 @@ Error TcpNode::SetSockOpt(int lvl,
AUTO_LOCK(node_lock_);
tcp_nodelay_ = *static_cast<const int*>(optval) != 0;
return SetNoDelay_Locked();
+ } else if (lvl == SOL_SOCKET && optname == SO_RCVBUF) {
+ if (static_cast<size_t>(len) < sizeof(int))
+ return EINVAL;
+ AUTO_LOCK(node_lock_);
+ int bufsize = *static_cast<const int*>(optval);
+ int32_t error =
+ TCPInterface()->SetOption(socket_resource_,
+ PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE,
+ PP_MakeInt32(bufsize),
+ PP_BlockUntilComplete());
+ return PPErrorToErrno(error);
+ } else if (lvl == SOL_SOCKET && optname == SO_SNDBUF) {
+ if (static_cast<size_t>(len) < sizeof(int))
+ return EINVAL;
+ AUTO_LOCK(node_lock_);
+ int bufsize = *static_cast<const int*>(optval);
+ int32_t error =
+ TCPInterface()->SetOption(socket_resource_,
+ PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE,
+ PP_MakeInt32(bufsize),
+ PP_BlockUntilComplete());
+ return PPErrorToErrno(error);
}
return SocketNode::SetSockOpt(lvl, optname, optval, len);
« no previous file with comments | « no previous file | native_client_sdk/src/libraries/nacl_io/socket/udp_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698