# HG changeset patch # User Eric Warmenhoven # Date 965710979 0 # Node ID 525c566741daf8c93e589aefa839b07291517fb4 # Parent 8f0ba638d8193a39627da1464af82d3fc35529c2 [gaim-migrate @ 648] small libfaim changes. no, it doesn't compile on solaris yet. committer: Tailor Script diff -r 8f0ba638d819 -r 525c566741da libfaim/CHANGES --- a/libfaim/CHANGES Tue Aug 08 02:22:54 2000 +0000 +++ b/libfaim/CHANGES Tue Aug 08 05:02:59 2000 +0000 @@ -1,6 +1,13 @@ No release numbers ------------------ + - Tue Aug 8 04:25:35 UTC 2000 + - Preserve subtype and priv after aim_conn_close + + - Tue Aug 8 04:15:47 UTC 2000 + - Fixed double-calling of faim_mutex_init + - conn->type preserved after aim_conn_close + - Mon Jul 17 01:56:31 UTC 2000 - Added 0004/000c callback (for message acknowledgments) - This goes with the AIM_IMFLAGS_ACK option that has been there diff -r 8f0ba638d819 -r 525c566741da libfaim/CHANGES.gaim --- a/libfaim/CHANGES.gaim Tue Aug 08 02:22:54 2000 +0000 +++ b/libfaim/CHANGES.gaim Tue Aug 08 05:02:59 2000 +0000 @@ -1,3 +1,7 @@ + +Tue Aug 8 04:59:55 UTC 2000 EWarmenhoven + - Small updates to libfaim. Hopefully this should fix a lot of the + conn->type segfaults and pthread hangs. Fri Jul 21 19:47:36 UTC 2000 EWarmenhoven - Direct IM. I think I ironed out most of the bugs. Now all I have diff -r 8f0ba638d819 -r 525c566741da libfaim/aim_conn.c --- 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, diff -r 8f0ba638d819 -r 525c566741da libfaim/faim/aim.h --- a/libfaim/faim/aim.h Tue Aug 08 02:22:54 2000 +0000 +++ b/libfaim/faim/aim.h Tue Aug 08 05:02:59 2000 +0000 @@ -43,6 +43,7 @@ #define faim_mutex_init pthread_mutex_init #define faim_mutex_lock pthread_mutex_lock #define faim_mutex_unlock pthread_mutex_unlock +#define faim_mutex_destroy pthread_mutex_destroy #elif defined(FAIM_USEFAKELOCKS) /* * For platforms without pthreads, we also assume @@ -55,6 +56,7 @@ #define faim_mutex_init(x, y) *x = 0 #define faim_mutex_lock(x) *x = 1; #define faim_mutex_unlock(x) *x = 0; +#define faim_mutex_destroy(x) *x = 0; #endif /* Portability stuff (DMP) */ diff -r 8f0ba638d819 -r 525c566741da src/oscar.c --- a/src/oscar.c Tue Aug 08 02:22:54 2000 +0000 +++ b/src/oscar.c Tue Aug 08 05:02:59 2000 +0000 @@ -113,16 +113,14 @@ debug_print(_("connection error (rend)\n")); } } else { - char *direct = NULL; - if (conn->type == AIM_CONN_TYPE_RENDEZVOUS && - conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) - direct = g_strdup(((struct aim_directim_priv *)conn->priv)->sn); if (aim_get_command(gaim_sess, conn) >= 0) { aim_rxdispatch(gaim_sess); } else { debug_print(_("connection error!\n")); - if (direct) { - struct conversation *cnv = find_conversation(direct); + if (conn->type == AIM_CONN_TYPE_RENDEZVOUS && + conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) { + struct conversation *cnv = + find_conversation(((struct aim_directim_priv *)conn->priv)->sn); debug_print("connection error for directim\n"); if (cnv) { make_direct(cnv, FALSE, NULL, 0); @@ -138,7 +136,6 @@ gdk_input_remove(inpa); } } - if (direct) g_free(direct); } } }