diff options
| author | Michael Adam <obnox@samba.org> | 2016-08-16 13:38:50 +0200 |
|---|---|---|
| committer | Andreas Schneider <asn@samba.org> | 2016-10-20 10:50:41 +0200 |
| commit | c3e5f78016f4319fb22126163d0ddbcac0bdeed5 (patch) | |
| tree | 773120c1ab075b13fd88c38f3836bd91fd058385 /src | |
| parent | 1e7528c2b1a027538b54bd3576eba1206265ae8c (diff) | |
| download | socket_wrapper-c3e5f78016f4319fb22126163d0ddbcac0bdeed5.tar.gz socket_wrapper-c3e5f78016f4319fb22126163d0ddbcac0bdeed5.tar.xz socket_wrapper-c3e5f78016f4319fb22126163d0ddbcac0bdeed5.zip | |
swrap: Optimization in (commented out) check_addr_port_in_use()
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/socket_wrapper.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index b7de67c..51d22df 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -1403,6 +1403,7 @@ static struct socket_info *find_socket_info(int fd) static bool check_addr_port_in_use(const struct sockaddr *sa, socklen_t len) { struct socket_info_fd *f; + const struct socket_info *last_s = NULL; /* first catch invalid input */ switch (sa->sa_family) { @@ -1426,6 +1427,11 @@ static bool check_addr_port_in_use(const struct sockaddr *sa, socklen_t len) for (f = socket_fds; f; f = f->next) { struct socket_info *s = f->si; + if (s == last_s) { + continue; + } + last_s = s; + if (s->myname == NULL) { continue; } |
