mirror of
https://github.com/Silicondust/libhdhomerun
synced 2025-08-20 05:23:27 -07:00
Merge b9d5d04fea
into e8f29fd4e0
This commit is contained in:
commit
0234271a33
1 changed files with 9 additions and 3 deletions
|
@ -306,12 +306,18 @@ bool hdhomerun_sock_connect_ex(struct hdhomerun_sock_t *sock, const struct socka
|
|||
poll_event.events = POLLOUT;
|
||||
poll_event.revents = 0;
|
||||
|
||||
if (poll(&poll_event, 1, (int)timeout) <= 0) {
|
||||
int ret = poll(&poll_event, 1, (int)timeout);
|
||||
if (ret < 0) {
|
||||
return false;
|
||||
} else if (ret == 0) {
|
||||
errno = ETIMEDOUT;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((poll_event.revents & POLLOUT) == 0) {
|
||||
return false;
|
||||
if (connect(sock->sock, (struct sockaddr *)&sock_addr, sizeof(sock_addr)) != 0) {
|
||||
if (errno != EISCONN) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue