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

Side by Side Diff: net/base/nss_memio.c

Issue 10919167: Increase the sizes of the circular buffers used by SSLClientSocketNSS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Use 17KB receive and read buffers Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/nss_memio.h ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // Written in NSPR style to also be suitable for adding to the NSS demo suite 4 // Written in NSPR style to also be suitable for adding to the NSS demo suite
5 5
6 /* memio is a simple NSPR I/O layer that lets you decouple NSS from 6 /* memio is a simple NSPR I/O layer that lets you decouple NSS from
7 * the real network. It's rather like openssl's memory bio, 7 * the real network. It's rather like openssl's memory bio,
8 * and is useful when your app absolutely, positively doesn't 8 * and is useful when your app absolutely, positively doesn't
9 * want to let NSS do its own networking. 9 * want to let NSS do its own networking.
10 */ 10 */
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 static PRDescIdentity memio_identity = PR_INVALID_IO_LAYER; 343 static PRDescIdentity memio_identity = PR_INVALID_IO_LAYER;
344 344
345 static PRStatus memio_InitializeLayerName(void) 345 static PRStatus memio_InitializeLayerName(void)
346 { 346 {
347 memio_identity = PR_GetUniqueIdentity("memio"); 347 memio_identity = PR_GetUniqueIdentity("memio");
348 return PR_SUCCESS; 348 return PR_SUCCESS;
349 } 349 }
350 350
351 /*--------------- public memio functions -----------------------*/ 351 /*--------------- public memio functions -----------------------*/
352 352
353 PRFileDesc *memio_CreateIOLayer(int bufsize) 353 PRFileDesc *memio_CreateIOLayer(int readbufsize, int writebufsize)
354 { 354 {
355 PRFileDesc *fd; 355 PRFileDesc *fd;
356 struct PRFilePrivate *secret; 356 struct PRFilePrivate *secret;
357 static PRCallOnceType once; 357 static PRCallOnceType once;
358 358
359 PR_CallOnce(&once, memio_InitializeLayerName); 359 PR_CallOnce(&once, memio_InitializeLayerName);
360 360
361 fd = PR_CreateIOLayerStub(memio_identity, &memio_layer_methods); 361 fd = PR_CreateIOLayerStub(memio_identity, &memio_layer_methods);
362 secret = malloc(sizeof(struct PRFilePrivate)); 362 secret = malloc(sizeof(struct PRFilePrivate));
363 memset(secret, 0, sizeof(*secret)); 363 memset(secret, 0, sizeof(*secret));
364 364
365 memio_buffer_new(&secret->readbuf, bufsize); 365 memio_buffer_new(&secret->readbuf, readbufsize);
366 memio_buffer_new(&secret->writebuf, bufsize); 366 memio_buffer_new(&secret->writebuf, writebufsize);
367 fd->secret = secret; 367 fd->secret = secret;
368 return fd; 368 return fd;
369 } 369 }
370 370
371 void memio_SetPeerName(PRFileDesc *fd, const PRNetAddr *peername) 371 void memio_SetPeerName(PRFileDesc *fd, const PRNetAddr *peername)
372 { 372 {
373 PRFileDesc *memiofd = PR_GetIdentitiesLayer(fd, memio_identity); 373 PRFileDesc *memiofd = PR_GetIdentitiesLayer(fd, memio_identity);
374 struct PRFilePrivate *secret = memiofd->secret; 374 struct PRFilePrivate *secret = memiofd->secret;
375 secret->peername = *peername; 375 secret->peername = *peername;
376 } 376 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 CHECKEQ(memio_buffer_unused_contiguous(&mb), 0); 491 CHECKEQ(memio_buffer_unused_contiguous(&mb), 0);
492 CHECKEQ(memio_buffer_used_contiguous(&mb), 1); 492 CHECKEQ(memio_buffer_used_contiguous(&mb), 1);
493 493
494 /* TODO: add more cases */ 494 /* TODO: add more cases */
495 495
496 printf("Test passed\n"); 496 printf("Test passed\n");
497 exit(0); 497 exit(0);
498 } 498 }
499 499
500 #endif 500 #endif
OLDNEW
« no previous file with comments | « net/base/nss_memio.h ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698