Crash fix
This commit is contained in:
parent
e120d5c76d
commit
aa18ac047d
|
@ -86,10 +86,10 @@ void net_on_read(int fd, short ev, void *arg)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (msglen < user->hub->config->max_recv_buffer)
|
||||
if (msglen < g_hub->config->max_recv_buffer)
|
||||
{
|
||||
// FIXME: hub is not set????
|
||||
if (hub_handle_message(user->hub, user, &buf[handled], msglen) == -1)
|
||||
if (hub_handle_message(g_hub, user, &buf[handled], msglen) == -1)
|
||||
{
|
||||
flag_close = quit_protocol_error;
|
||||
more = 0;
|
||||
|
@ -109,7 +109,7 @@ void net_on_read(int fd, short ev, void *arg)
|
|||
|
||||
if (handled < buflen)
|
||||
{
|
||||
if ((buflen - handled) > user->hub->config->max_recv_buffer)
|
||||
if ((buflen - handled) > g_hub->config->max_recv_buffer)
|
||||
{
|
||||
user_flag_set(user, flag_maxbuf);
|
||||
hub_free(user->recv_buf);
|
||||
|
@ -119,7 +119,7 @@ void net_on_read(int fd, short ev, void *arg)
|
|||
else
|
||||
{
|
||||
if (!user->recv_buf)
|
||||
user->recv_buf = hub_malloc(user->hub->config->max_recv_buffer);
|
||||
user->recv_buf = hub_malloc(g_hub->config->max_recv_buffer);
|
||||
|
||||
if (user->recv_buf)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ struct user* user_create(struct hub_info* hub, int sd)
|
|||
|
||||
user->sd = sd;
|
||||
user->tm_connected = time(NULL);
|
||||
user->hub = hub;
|
||||
// user->hub = hub;
|
||||
user->feature_cast = 0;
|
||||
|
||||
user->send_queue = list_create();
|
||||
|
|
|
@ -160,7 +160,15 @@ int uman_remove(struct hub_info* hub, struct user* user)
|
|||
return -1;
|
||||
|
||||
list_remove(hub->users->list, user);
|
||||
hub->users->count--;
|
||||
|
||||
if (hub->users->count > 0)
|
||||
{
|
||||
hub->users->count--;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(!"negative count!");
|
||||
}
|
||||
|
||||
hub->users->shared_size -= user->limits.shared_size;
|
||||
hub->users->shared_files -= user->limits.shared_files;
|
||||
|
|
Loading…
Reference in New Issue