Changeset cc227c7270cfc3ba47f988df3cdaf232a41a8f34
- Timestamp:
- 01/21/08 18:12:41
(8 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1200935561 +0000
- git-parent:
[370f789fed007cb60ba145ff7af76417f2eaeee2]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1200935561 +0000
- Message:
Set non-blocking mode on accepted sockets
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rcac92f5 |
rcc227c7 |
|
| 87 | 87 | } |
|---|
| 88 | 88 | |
|---|
| | 89 | |
|---|
| | 90 | VLC_EXPORT( int, net_AcceptSingle, (vlc_object_t *obj, int lfd) ); |
|---|
| | 91 | |
|---|
| 89 | 92 | #define net_Accept(a, b, c) __net_Accept(VLC_OBJECT(a), b, c) |
|---|
| 90 | 93 | VLC_EXPORT( int, __net_Accept, ( vlc_object_t *, int *, mtime_t ) ); |
|---|
| r165459a |
rcc227c7 |
|
| 491 | 491 | continue; |
|---|
| 492 | 492 | |
|---|
| 493 | | fd = accept (ufd[ncli + i].fd, NULL, NULL); |
|---|
| | 493 | fd = net_AcceptSingle (VLC_OBJECT(p_intf), ufd[ncli + i].fd); |
|---|
| 494 | 494 | if (fd == -1) |
|---|
| 495 | 495 | continue; |
|---|
| r968f7ba |
rcc227c7 |
|
| 2510 | 2510 | httpd_client_t *cl; |
|---|
| 2511 | 2511 | int i_state = -1; |
|---|
| 2512 | | |
|---|
| 2513 | | assert (ufd[nfd].fd == host->fds[nfd]); |
|---|
| | 2512 | int fd = ufd[nfd].fd; |
|---|
| | 2513 | |
|---|
| | 2514 | assert (fd == host->fds[nfd]); |
|---|
| 2514 | 2515 | |
|---|
| 2515 | 2516 | if( ufd[nfd].revents == 0 ) |
|---|
| … | … | |
| 2517 | 2518 | |
|---|
| 2518 | 2519 | /* */ |
|---|
| 2519 | | int fd = accept (ufd[nfd].fd, NULL, NULL); |
|---|
| | 2520 | fd = accept (fd, NULL, NULL); |
|---|
| 2520 | 2521 | if (fd == -1) |
|---|
| 2521 | 2522 | continue; |
|---|
| 2522 | 2523 | |
|---|
| | 2524 | net_SetupSocket (fd); |
|---|
| 2523 | 2525 | if( p_tls != NULL ) |
|---|
| 2524 | 2526 | { |
|---|
| r4f02842 |
rcc227c7 |
|
| 259 | 259 | |
|---|
| 260 | 260 | |
|---|
| | 261 | int net_AcceptSingle (vlc_object_t *obj, int lfd) |
|---|
| | 262 | { |
|---|
| | 263 | int fd = accept (lfd, NULL, NULL); |
|---|
| | 264 | if (fd == -1) |
|---|
| | 265 | { |
|---|
| | 266 | if (net_errno != EAGAIN) |
|---|
| | 267 | msg_Err (obj, "accept failed (from socket %d): %m", lfd); |
|---|
| | 268 | return -1; |
|---|
| | 269 | } |
|---|
| | 270 | |
|---|
| | 271 | msg_Dbg (obj, "accepted socket %d (from socket %d)", fd, lfd); |
|---|
| | 272 | net_SetupSocket (fd); |
|---|
| | 273 | return 0; |
|---|
| | 274 | } |
|---|
| | 275 | |
|---|
| | 276 | |
|---|
| 261 | 277 | /***************************************************************************** |
|---|
| 262 | 278 | * __net_Accept: |
|---|
| … | … | |
| 313 | 329 | |
|---|
| 314 | 330 | int sfd = ufd[i].fd; |
|---|
| 315 | | int fd = accept (sfd, NULL, NULL); |
|---|
| | 331 | int fd = net_AcceptSingle (p_this, sfd); |
|---|
| 316 | 332 | if (fd == -1) |
|---|
| 317 | | { |
|---|
| 318 | | msg_Err (p_this, "accept failed (%m)"); |
|---|
| 319 | 333 | continue; |
|---|
| 320 | | } |
|---|
| 321 | | net_SetupSocket (fd); |
|---|
| 322 | 334 | |
|---|
| 323 | 335 | /* |
|---|
| … | … | |
| 328 | 340 | pi_fd[n - 1] = sfd; |
|---|
| 329 | 341 | vlc_object_unlock (p_this); |
|---|
| 330 | | msg_Dbg (p_this, "accepted socket %d (from socket %d)", fd, sfd); |
|---|
| 331 | 342 | return fd; |
|---|
| 332 | 343 | } |
|---|