From a9447331a639832a1c75b3f797757ed4139ec1d2 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 22 Oct 2014 16:05:35 -0700 Subject: [PATCH] stream-tcp, stream-ssl: Remove unneeded getsockname() calls. Commit a8d819675f3 (Remove stream, vconn, and rconn functions to get local/remote IPs/ports.) removed the code that used the local socket address but neglected to remove the code to fetch that address. This commit removes the latter code also. Reported-by: Eitan Eliahu Signed-off-by: Ben Pfaff Acked-by: Eitan Eliahu --- lib/stream-ssl.c | 8 -------- lib/stream-tcp.c | 8 -------- 2 files changed, 16 deletions(-) diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c index dd400102c..d1fa88a7f 100644 --- a/lib/stream-ssl.c +++ b/lib/stream-ssl.c @@ -236,8 +236,6 @@ static int new_ssl_stream(const char *name, int fd, enum session_type type, enum ssl_state state, struct stream **streamp) { - struct sockaddr_storage local; - socklen_t local_len = sizeof local; struct ssl_stream *sslv; SSL *ssl = NULL; int retval; @@ -265,12 +263,6 @@ new_ssl_stream(const char *name, int fd, enum session_type type, goto error; } - /* Get the local IP and port information */ - retval = getsockname(fd, (struct sockaddr *) &local, &local_len); - if (retval) { - memset(&local, 0, sizeof local); - } - /* Disable Nagle. * On windows platforms, this can only be called upon TCP connected. */ diff --git a/lib/stream-tcp.c b/lib/stream-tcp.c index ea6ef696a..043a30b43 100644 --- a/lib/stream-tcp.c +++ b/lib/stream-tcp.c @@ -42,17 +42,9 @@ static int new_tcp_stream(const char *name, int fd, int connect_status, struct stream **streamp) { - struct sockaddr_storage local; - socklen_t local_len = sizeof local; int on = 1; int retval; - /* Get the local IP and port information */ - retval = getsockname(fd, (struct sockaddr *) &local, &local_len); - if (retval) { - memset(&local, 0, sizeof local); - } - retval = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof on); if (retval) { int error = sock_errno(); -- 2.39.5