Fix some asserts.

This commit is contained in:
Jan Vidar Krey 2009-08-04 04:58:55 +02:00
parent 1642b8dfbe
commit d45383fe4d
3 changed files with 5 additions and 20 deletions

View File

@ -13,7 +13,7 @@ USE_SSL ?= NO
USE_BIGENDIAN ?= AUTO
BITS ?= AUTO
SILENT ?= YES
LDLIBS += -levent
LDLIBS += -lev
TERSE ?= NO
STACK_PROTECT ?= NO

View File

@ -959,8 +959,6 @@ void hub_schedule_destroy_user(struct hub_info* hub, struct hub_user* user)
post.ptr = user;
event_queue_post(hub->queue, &post);
net_con_close(&user->net.connection);
if (user->id.sid)
{
sid_free(hub->users->sids, user->id.sid);
@ -976,20 +974,6 @@ void hub_disconnect_all(struct hub_info* hub)
event_queue_post(hub->queue, &post);
}
void hub_schedule_destroy_all(struct hub_info* hub)
{
struct hub_user* user = (struct hub_user*) list_get_first(hub->users->list);
while (user)
{
hub_schedule_destroy_user(hub, user);
user = (struct hub_user*) list_get_next(hub->users->list);
}
}
void hub_event_loop(struct hub_info* hub)
{
int ret;
@ -1035,6 +1019,7 @@ void hub_disconnect_user(struct hub_info* hub, struct hub_user* user, int reason
/* stop reading from user */
net_shutdown_r(user->net.connection.sd);
net_con_close(&user->net.connection);
LOG_TRACE("hub_disconnect_user(), user=%p, reason=%d, state=%d", user, reason, user->state);

View File

@ -140,7 +140,7 @@ void net_con_update(struct net_connection* con, int ev)
if (events & EV_READ) net_con_flag_set(con, NET_WANT_READ);
if (events & EV_WRITE) net_con_flag_set(con, NET_WANT_WRITE);
if (event_pending(&con->event, EV_READ | EV_WRITE, 0) == events)
if (con->sd == -1 || event_pending(&con->event, EV_READ | EV_WRITE, 0) == events)
return;
event_del(&con->event);