… | |
… | |
129 | |
129 | |
130 | int fd = accept (w.fd, (sockaddr *)&sa, &sa_len); |
130 | int fd = accept (w.fd, (sockaddr *)&sa, &sa_len); |
131 | |
131 | |
132 | if (fd >= 0) |
132 | if (fd >= 0) |
133 | { |
133 | { |
134 | sockinfo si(sa, PROT_TCPv4); |
|
|
135 | |
|
|
136 | slog (L_DEBUG, _("%s: accepted tcp connection"), (const char *)si);//D |
|
|
137 | |
|
|
138 | fcntl (fd, F_SETFL, O_NONBLOCK); |
134 | fcntl (fd, F_SETFL, O_NONBLOCK); |
139 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
135 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
|
|
136 | |
|
|
137 | sockinfo si(sa, PROT_TCPv4); |
|
|
138 | |
|
|
139 | slog (L_DEBUG, _("%s: accepted tcp connection"), (const char *)si);//D |
140 | |
140 | |
141 | tcp_connection *i = new tcp_connection (fd, si, *this); |
141 | tcp_connection *i = new tcp_connection (fd, si, *this); |
142 | tcp_si.insert (*i); |
142 | tcp_si.insert (*i); |
143 | } |
143 | } |
144 | } |
144 | } |
… | |
… | |
389 | fcntl (fd, F_SETFL, O_NONBLOCK); |
389 | fcntl (fd, F_SETFL, O_NONBLOCK); |
390 | |
390 | |
391 | if (connect (fd, csi->sav4 (), csi->salenv4 ()) >= 0 |
391 | if (connect (fd, csi->sav4 (), csi->salenv4 ()) >= 0 |
392 | || errno == EINPROGRESS) |
392 | || errno == EINPROGRESS) |
393 | { |
393 | { |
|
|
394 | fcntl (fd, F_SETFL, O_NONBLOCK); |
|
|
395 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
|
|
396 | |
394 | state = CONNECTING; |
397 | state = CONNECTING; |
395 | start (fd, EVENT_WRITE); |
398 | start (fd, EVENT_WRITE); |
396 | } |
399 | } |
397 | else |
400 | else |
398 | close (fd); |
401 | close (fd); |