|
Lines 956-971
after_select(fd_set *readset, fd_set *wr
Link Here
|
| 956 |
case AUTH_CONNECTION: |
956 |
case AUTH_CONNECTION: |
| 957 |
if (buffer_len(&sockets[i].output) > 0 && |
957 |
if (buffer_len(&sockets[i].output) > 0 && |
| 958 |
FD_ISSET(sockets[i].fd, writeset)) { |
958 |
FD_ISSET(sockets[i].fd, writeset)) { |
| 959 |
do { |
959 |
len = write(sockets[i].fd, |
| 960 |
len = write(sockets[i].fd, |
960 |
buffer_ptr(&sockets[i].output), |
| 961 |
buffer_ptr(&sockets[i].output), |
961 |
buffer_len(&sockets[i].output)); |
| 962 |
buffer_len(&sockets[i].output)); |
962 |
if (len == -1 && (errno == EAGAIN || |
| 963 |
if (len == -1 && (errno == EAGAIN || |
963 |
errno == EINTR || |
| 964 |
errno == EINTR || |
964 |
errno == EWOULDBLOCK)) |
| 965 |
errno == EWOULDBLOCK)) |
965 |
continue; |
| 966 |
continue; |
|
|
| 967 |
break; |
| 968 |
} while (1); |
| 969 |
if (len <= 0) { |
966 |
if (len <= 0) { |
| 970 |
close_socket(&sockets[i]); |
967 |
close_socket(&sockets[i]); |
| 971 |
break; |
968 |
break; |
|
Lines 973-986
after_select(fd_set *readset, fd_set *wr
Link Here
|
| 973 |
buffer_consume(&sockets[i].output, len); |
970 |
buffer_consume(&sockets[i].output, len); |
| 974 |
} |
971 |
} |
| 975 |
if (FD_ISSET(sockets[i].fd, readset)) { |
972 |
if (FD_ISSET(sockets[i].fd, readset)) { |
| 976 |
do { |
973 |
len = read(sockets[i].fd, buf, sizeof(buf)); |
| 977 |
len = read(sockets[i].fd, buf, sizeof(buf)); |
974 |
if (len == -1 && (errno == EAGAIN || |
| 978 |
if (len == -1 && (errno == EAGAIN || |
975 |
errno == EINTR || |
| 979 |
errno == EINTR || |
976 |
errno == EWOULDBLOCK)) |
| 980 |
errno == EWOULDBLOCK)) |
977 |
continue; |
| 981 |
continue; |
|
|
| 982 |
break; |
| 983 |
} while (1); |
| 984 |
if (len <= 0) { |
978 |
if (len <= 0) { |
| 985 |
close_socket(&sockets[i]); |
979 |
close_socket(&sockets[i]); |
| 986 |
break; |
980 |
break; |