Crash fix.

This commit is contained in:
Jan Vidar Krey
2009-11-21 11:47:26 +01:00
parent e994f23ea0
commit 53536f191d
6 changed files with 31 additions and 69 deletions

View File

@@ -1030,10 +1030,7 @@ void hub_disconnect_user(struct hub_info* hub, struct hub_user* user, int reason
/* stop reading from user */
net_shutdown_r(user->connection->sd);
if (net_con_close(user->connection))
{
hub_free(user->connection);
}
net_con_close(user->connection);
user->connection = 0;
LOG_TRACE("hub_disconnect_user(), user=%p, reason=%d, state=%d", user, reason, user->state);

View File

@@ -171,17 +171,6 @@ void net_event(struct net_connection* con, int event, void *arg)
struct hub_user* user = (struct hub_user*) arg;
int flag_close = 0;
if (event == NET_EVENT_DESTROYED)
{
LOG_PROTO("NET_EVENT_DESTROYED: con=%p, user=%p\n", con, user);
if (user)
{
user->connection = 0;
}
hub_free(con);
return;
}
#ifdef DEBUG_SENDQ
LOG_TRACE("net_event() : fd=%d, ev=%d, arg=%p", fd, (int) event, arg);
#endif

View File

@@ -27,16 +27,6 @@ static void probe_net_event(struct net_connection* con, int events, void *arg)
{
struct hub_probe* probe = (struct hub_probe*) con->ptr;
if (events == NET_EVENT_DESTROYED)
{
if (probe)
{
probe->connection = 0;
}
hub_free(con);
return;
}
if (events == NET_EVENT_SOCKERROR || events == NET_EVENT_CLOSED || events == NET_EVENT_TIMEOUT)
{
probe_destroy(probe);
@@ -123,10 +113,7 @@ void probe_destroy(struct hub_probe* probe)
{
if (probe->connection)
{
if (net_con_close(probe->connection))
{
hub_free(probe->connection);
}
net_con_close(probe->connection);
probe->connection = 0;
}
hub_free(probe);