summaryrefslogtreecommitdiffstats
path: root/net/socket
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 00:59:41 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 00:59:41 +0000
commit826ce7cef9a43e42edc0de833b8dd147a48ee5d5 (patch)
tree021464e996e178d7e5159e8580371dd002c46718 /net/socket
parentdbe9e959bca20325ac875134dc1367404be1368b (diff)
downloadchromium_src-826ce7cef9a43e42edc0de833b8dd147a48ee5d5.zip
chromium_src-826ce7cef9a43e42edc0de833b8dd147a48ee5d5.tar.gz
chromium_src-826ce7cef9a43e42edc0de833b8dd147a48ee5d5.tar.bz2
Increase the sizes of the circular buffers used by SSLClientSocketNSS
and SSLServerSocketNSS. Larger buffers result in fewer Read() and Write() calls, improving performance. R=rsleevi@chromium.org,agl@chromium.org BUG=69813 TEST=none Review URL: https://chromiumcodereview.appspot.com/10919167 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155889 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r--net/socket/ssl_client_socket_nss.cc10
-rw-r--r--net/socket/ssl_server_socket_nss.cc10
2 files changed, 14 insertions, 6 deletions
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 6a897aa..04f0ab3 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -118,7 +118,12 @@
#include <dlfcn.h>
#endif
-static const int kRecvBufferSize = 4096;
+// SSL plaintext fragments are shorter than 16KB. Although the record layer
+// overhead is allowed to be 2K + 5 bytes, in practice the overhead is much
+// smaller than 1KB. So a 17KB buffer should be large enough to hold an
+// entire SSL record.
+static const int kRecvBufferSize = 17 * 1024;
+static const int kSendBufferSize = 17 * 1024;
#if defined(OS_WIN)
// CERT_OCSP_RESPONSE_PROP_ID is only implemented on Vista+, but it can be
@@ -3067,8 +3072,7 @@ void SSLClientSocketNSS::InitCore() {
int SSLClientSocketNSS::InitializeSSLOptions() {
// Transport connected, now hook it up to nss
- // TODO(port): specify rx and tx buffer sizes separately
- nss_fd_ = memio_CreateIOLayer(kRecvBufferSize);
+ nss_fd_ = memio_CreateIOLayer(kRecvBufferSize, kSendBufferSize);
if (nss_fd_ == NULL) {
return ERR_OUT_OF_MEMORY; // TODO(port): map NSPR error code.
}
diff --git a/net/socket/ssl_server_socket_nss.cc b/net/socket/ssl_server_socket_nss.cc
index 7203881..5dd6eb8 100644
--- a/net/socket/ssl_server_socket_nss.cc
+++ b/net/socket/ssl_server_socket_nss.cc
@@ -40,7 +40,12 @@
#include "net/socket/nss_ssl_util.h"
#include "net/socket/ssl_error_params.h"
-static const int kRecvBufferSize = 4096;
+// SSL plaintext fragments are shorter than 16KB. Although the record layer
+// overhead is allowed to be 2K + 5 bytes, in practice the overhead is much
+// smaller than 1KB. So a 17KB buffer should be large enough to hold an
+// entire SSL record.
+static const int kRecvBufferSize = 17 * 1024;
+static const int kSendBufferSize = 17 * 1024;
#define GotoState(s) next_handshake_state_ = s
@@ -313,8 +318,7 @@ bool SSLServerSocketNSS::GetSSLInfo(SSLInfo* ssl_info) {
int SSLServerSocketNSS::InitializeSSLOptions() {
// Transport connected, now hook it up to nss
- // TODO(port): specify rx and tx buffer sizes separately
- nss_fd_ = memio_CreateIOLayer(kRecvBufferSize);
+ nss_fd_ = memio_CreateIOLayer(kRecvBufferSize, kSendBufferSize);
if (nss_fd_ == NULL) {
return ERR_OUT_OF_MEMORY; // TODO(port): map NSPR error code.
}