Use non-blocking socket() and pipe() wrappers

Change-Id: I050ceffe5a133d5add2dab46687209813d58f597
This commit is contained in:
Sean Bright
2018-12-11 09:54:43 -05:00
parent 82473227be
commit 42ff856216
5 changed files with 12 additions and 27 deletions

View File

@@ -2071,16 +2071,11 @@ static enum agi_result launch_netscript(char *agiurl, char *argv[], int *fds)
ast_sockaddr_set_port(&addrs[i], AGI_PORT);
}
if ((s = socket(addrs[i].ss.ss_family, SOCK_STREAM, IPPROTO_TCP)) < 0) {
if ((s = ast_socket_nonblock(addrs[i].ss.ss_family, SOCK_STREAM, IPPROTO_TCP)) < 0) {
ast_log(LOG_WARNING, "Unable to create socket: %s\n", strerror(errno));
continue;
}
if (ast_fd_set_flags(s, O_NONBLOCK)) {
close(s);
continue;
}
if (ast_connect(s, &addrs[i]) && errno == EINPROGRESS) {
if (handle_connection(agiurl, addrs[i], s)) {