aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Robbie Shade <rjshade@google.com>2016-06-08 08:40:56 -0400
committerGravatar Robbie Shade <rjshade@google.com>2016-06-08 08:40:56 -0400
commit3f30e634a6eb72baebe03a1e4757029918076cae (patch)
tree4534a007a2421b7fd237b31932563ff8a0c0d144 /test
parent2c57371b937e6ac37b2d331a817bb7f1e33b5383 (diff)
Adds functions to set snd/rcv socket buffer sizes.
Used for non-default 1 MB UDP socket buffers.
Diffstat (limited to 'test')
-rw-r--r--test/core/iomgr/fd_posix_test.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c
index f97f33712e..ad66542202 100644
--- a/test/core/iomgr/fd_posix_test.c
+++ b/test/core/iomgr/fd_posix_test.c
@@ -68,17 +68,15 @@ static void create_test_socket(int port, int *socket_fd,
struct sockaddr_in *sin) {
int fd;
int one = 1;
- int buf_size = BUF_SIZE;
+ int buffer_size_bytes = BUF_SIZE;
int flags;
fd = socket(AF_INET, SOCK_STREAM, 0);
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
/* Reset the size of socket send buffer to the minimal value to facilitate
buffer filling up and triggering notify_on_write */
- GPR_ASSERT(
- setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &buf_size, sizeof(buf_size)) != -1);
- GPR_ASSERT(
- setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &buf_size, sizeof(buf_size)) != -1);
+ GPR_ASSERT(grpc_set_socket_sndbuf(fd, buffer_size_bytes));
+ GPR_ASSERT(grpc_set_socket_rcvbuf(fd, buffer_size_bytes));
/* Make fd non-blocking */
flags = fcntl(fd, F_GETFL, 0);
GPR_ASSERT(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == 0);