Mercurial > pidgin.yaz
diff libfaim/aim_conn.c @ 638:525c566741da
[gaim-migrate @ 648]
small libfaim changes. no, it doesn't compile on solaris yet.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 08 Aug 2000 05:02:59 +0000 |
parents | e4c34ca88d9b |
children | 668b4d544afe |
line wrap: on
line diff
--- a/libfaim/aim_conn.c Tue Aug 08 02:22:54 2000 +0000 +++ b/libfaim/aim_conn.c Tue Aug 08 05:02:59 2000 +0000 @@ -55,6 +55,25 @@ return newconn; } +static void aim_conn_init(struct aim_conn_t *deadconn) +{ + if (!deadconn) + return; + + deadconn->fd = -1; + deadconn->subtype = -1; + deadconn->type = -1; + deadconn->seqnum = 0; + deadconn->lastactivity = 0; + deadconn->forcedlatency = 0; + deadconn->handlerlist = NULL; + deadconn->priv = NULL; + faim_mutex_init(&deadconn->active, NULL); + faim_mutex_init(&deadconn->seqnum_lock, NULL); + + return; +} + void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **deadconn) { struct aim_conn_t *cur; @@ -83,7 +102,7 @@ /* XXX: do we need this for txqueue too? */ aim_rxqueue_cleanbyconn(sess, *deadconn); - aim_conn_close(*deadconn); + aim_conn_init(*deadconn); free(*deadconn); deadconn = NULL; @@ -92,21 +111,32 @@ void aim_conn_close(struct aim_conn_t *deadconn) { + int typesav = -1, subtypesav = -1; + void *privsav = NULL; + + faim_mutex_destroy(&deadconn->active); + faim_mutex_destroy(&deadconn->seqnum_lock); if (deadconn->fd >= 3) close(deadconn->fd); - deadconn->fd = -1; - deadconn->type = -1; - deadconn->seqnum = 0; - deadconn->lastactivity = 0; - deadconn->forcedlatency = 0; if (deadconn->handlerlist) aim_clearhandlers(deadconn); - deadconn->handlerlist = NULL; - if (deadconn->priv) + + typesav = deadconn->type; + subtypesav = deadconn->subtype; + + if (deadconn->priv && (deadconn->type != AIM_CONN_TYPE_RENDEZVOUS)) { free(deadconn->priv); - deadconn->priv = NULL; - faim_mutex_init(&deadconn->active, NULL); - faim_mutex_init(&deadconn->seqnum_lock, NULL); + deadconn->priv = NULL; + } + privsav = deadconn->priv; + + aim_conn_init(deadconn); + + deadconn->type = typesav; + deadconn->subtype = subtypesav; + deadconn->priv = privsav; + + return; } struct aim_conn_t *aim_getconn_type(struct aim_session_t *sess,