mirror of
https://github.com/bgp/bgpq4
synced 2025-02-28 08:53:11 +00:00
Remove select, use system default
Remove not-needed shutdown() Thanks Theo
This commit is contained in:
@@ -477,7 +477,6 @@ bgpq_selread(struct bgpq_expander* b, char* buffer, int size)
|
|||||||
{
|
{
|
||||||
fd_set rfd, wfd;
|
fd_set rfd, wfd;
|
||||||
int ret;
|
int ret;
|
||||||
struct timeval timeout = {30, 0};
|
|
||||||
|
|
||||||
repeat:
|
repeat:
|
||||||
FD_ZERO(&rfd);
|
FD_ZERO(&rfd);
|
||||||
@@ -487,10 +486,10 @@ repeat:
|
|||||||
if (!STAILQ_EMPTY(&b->wq))
|
if (!STAILQ_EMPTY(&b->wq))
|
||||||
FD_SET(b->fd, &wfd);
|
FD_SET(b->fd, &wfd);
|
||||||
|
|
||||||
ret = select(b->fd + 1, &rfd, &wfd, NULL, &timeout);
|
ret = select(b->fd + 1, &rfd, &wfd, NULL, NULL);
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
sx_report(SX_FATAL, "select timeout\n");
|
sx_report(SX_FATAL, "select failed\n");
|
||||||
else if (ret == -1 && errno == EINTR)
|
else if (ret == -1 && errno == EINTR)
|
||||||
goto repeat;
|
goto repeat;
|
||||||
else if (ret == -1)
|
else if (ret == -1)
|
||||||
@@ -876,13 +875,11 @@ bgpq_expand(struct bgpq_expander* b)
|
|||||||
sizeof(struct linger))) {
|
sizeof(struct linger))) {
|
||||||
sx_report(SX_ERROR,"Unable to set linger on socket: "
|
sx_report(SX_ERROR,"Unable to set linger on socket: "
|
||||||
"%s\n", strerror(errno));
|
"%s\n", strerror(errno));
|
||||||
shutdown(fd, SHUT_RDWR);
|
|
||||||
close(fd);
|
close(fd);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
err = connect(fd, rp->ai_addr, rp->ai_addrlen);
|
err = connect(fd, rp->ai_addr, rp->ai_addrlen);
|
||||||
if (err) {
|
if (err) {
|
||||||
shutdown(fd, SHUT_RDWR);
|
|
||||||
close(fd);
|
close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
continue;
|
continue;
|
||||||
@@ -892,7 +889,6 @@ bgpq_expand(struct bgpq_expander* b)
|
|||||||
SX_DEBUG(debug_expander, "Acquired sendbuf of %i "
|
SX_DEBUG(debug_expander, "Acquired sendbuf of %i "
|
||||||
"bytes\n", err);
|
"bytes\n", err);
|
||||||
} else {
|
} else {
|
||||||
shutdown(fd, SHUT_RDWR);
|
|
||||||
close(fd);
|
close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
continue;
|
continue;
|
||||||
@@ -1084,7 +1080,6 @@ bgpq_expand(struct bgpq_expander* b)
|
|||||||
fl &= ~O_NONBLOCK;
|
fl &= ~O_NONBLOCK;
|
||||||
fcntl(fd, F_SETFL, fl);
|
fcntl(fd, F_SETFL, fl);
|
||||||
}
|
}
|
||||||
shutdown(fd, SHUT_RDWR);
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user