Make sure we detect send errors.

This commit is contained in:
Jan Vidar Krey 2009-07-19 03:39:11 +02:00
parent 5f0c84f46a
commit bbae2603b0
1 changed files with 5 additions and 3 deletions

View File

@ -215,8 +215,11 @@ int handle_net_write(struct user* user)
while (hub_sendq_get_bytes(user->net.send_queue))
{
int ret = hub_sendq_send(user->net.send_queue, net_user_send, user);
if (ret <= 0)
if (ret == 0 || (ret == -1 && (net_error() == EAGAIN || net_error() == EINTR)))
break;
if (ret < 0)
return quit_socket_error;
}
if (hub_sendq_get_bytes(user->net.send_queue))
@ -256,8 +259,7 @@ void net_event(int fd, short ev, void *arg)
{
flag_close = handle_net_read(user);
}
if (ev & EV_WRITE)
else if (ev & EV_WRITE)
{
flag_close = handle_net_write(user);
}