Changeset 799fa2004db121688cec8a61e7be16d4d04f4dfa
- Timestamp:
- 12/06/08 19:09:53
(4 months ago)
- Author:
- Rémi Denis-Courmont <rdenis@simphalempin.com>
- git-committer:
- Rémi Denis-Courmont <rdenis@simphalempin.com> 1213290593 +0300
- git-parent:
[ce5d66353521887ee67482d2a13178ee240216f1]
- git-author:
- Rémi Denis-Courmont <rdenis@simphalempin.com> 1213290593 +0300
- Message:
Network: handle interrupts when reading and some comments
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rd666030 |
r799fa20 |
|
| 371 | 371 | n = i_buflen; |
|---|
| 372 | 372 | break; |
|---|
| 373 | | |
|---|
| 374 | | default: |
|---|
| 375 | | goto error; |
|---|
| 376 | 373 | } |
|---|
| 377 | 374 | #else |
|---|
| 378 | | /* spurious wake-up or TLS did not yield any actual data */ |
|---|
| 379 | | if (errno == EAGAIN) |
|---|
| 380 | | continue; |
|---|
| | 375 | switch (errno) |
|---|
| | 376 | { |
|---|
| | 377 | case EAGAIN: /* spurious wakeup or no TLS data */ |
|---|
| | 378 | case EINTR: /* asynchronous signal */ |
|---|
| | 379 | continue; |
|---|
| | 380 | } |
|---|
| | 381 | #endif |
|---|
| 381 | 382 | goto error; |
|---|
| 382 | | #endif |
|---|
| 383 | 383 | } |
|---|
| 384 | 384 | |
|---|
| … | … | |
| 430 | 430 | if (poll (ufd, 1, -1) == -1) |
|---|
| 431 | 431 | { |
|---|
| 432 | | if (errno != EINTR) |
|---|
| 433 | | { |
|---|
| 434 | | msg_Err (p_this, "Write error: %m"); |
|---|
| 435 | | goto error; |
|---|
| 436 | | } |
|---|
| 437 | | continue; |
|---|
| | 432 | if (errno == EINTR) |
|---|
| | 433 | continue; |
|---|
| | 434 | msg_Err (p_this, "Polling error: %m"); |
|---|
| | 435 | return -1; |
|---|
| 438 | 436 | } |
|---|
| 439 | 437 | |
|---|
| 440 | 438 | if (i_total > 0) |
|---|
| 441 | | { |
|---|
| 442 | | /* Errors will be dequeued separately, upon next call. */ |
|---|
| 443 | | if (ufd[0].revents & (POLLERR|POLLNVAL|POLLHUP)) |
|---|
| | 439 | { /* If POLLHUP resp. POLLERR|POLLNVAL occurs while we have already |
|---|
| | 440 | * read some data, it is important that we first return the number |
|---|
| | 441 | * of bytes read, and then return 0 resp. -1 on the NEXT call. */ |
|---|
| | 442 | if (ufd[0].revents & (POLLHUP|POLLERR|POLLNVAL)) |
|---|
| 444 | 443 | break; |
|---|
| 445 | | if (ufd[1].revents) |
|---|
| | 444 | if (ufd[1].revents) /* VLC object signaled */ |
|---|
| 446 | 445 | break; |
|---|
| 447 | 446 | } |
|---|
| … | … | |
| 467 | 466 | if (val == -1) |
|---|
| 468 | 467 | { |
|---|
| | 468 | if (errno == EINTR) |
|---|
| | 469 | continue; |
|---|
| 469 | 470 | msg_Err (p_this, "Write error: %m"); |
|---|
| 470 | 471 | break; |
|---|