diff --git a/gate/main.c b/gate/main.c index 79545687..99b6c71d 100644 --- a/gate/main.c +++ b/gate/main.c @@ -166,10 +166,12 @@ _gen_id(struct gate * g, int connection_id) { static void _remove_id(struct gate *g, int uid) { - struct connection * conn = _id_to_agent(g,uid); + struct connection ** pconn = &g->agent[uid & (g->cap - 1)]; + struct connection * conn = *pconn; assert(conn->uid == uid); conn->uid = 0; conn->agent = 0; + *pconn = NULL; } static int