--- mqtt/src/daemon.c 2012/04/25 13:33:53 1.2.2.13 +++ mqtt/src/daemon.c 2012/04/25 13:40:02 1.2.2.14 @@ -248,12 +248,11 @@ thrSession(struct tagSession *sess) break; case MQTT_TYPE_DISCONNECT: ioDEBUG(5, "Exec DISCONNECT session"); - finiSession(sess); - SESS_LOCK; TAILQ_REMOVE(&Sessions, sess, sess_node); SESS_UNLOCK; + finiSession(sess); locKill ^= locKill; continue; case MQTT_TYPE_PUBLISH: