Skip to content

Commit

Permalink
stream-tcp, stream-ssl: Remove unneeded getsockname() calls.
Browse files Browse the repository at this point in the history
Commit a8d8196 (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 <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Eitan Eliahu <[email protected]>
  • Loading branch information
blp committed Oct 23, 2014
1 parent cb85b49 commit a944733
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
8 changes: 0 additions & 8 deletions lib/stream-ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*/
Expand Down
8 changes: 0 additions & 8 deletions lib/stream-tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit a944733

Please sign in to comment.