]> andersk Git - libfaim.git/commitdiff
Locking around tx seqnum.
authormid <mid>
Tue, 30 May 2000 21:51:50 +0000 (21:51 +0000)
committermid <mid>
Tue, 30 May 2000 21:51:50 +0000 (21:51 +0000)
aim_conn.c
aim_txqueue.c
faim/aim.h

index 0396f8856ff79da05414bb1c02c2273ca10fb4e0..c520b0ca1b2164f331a1517da6301da5533bd99c 100644 (file)
@@ -40,6 +40,7 @@ void aim_conn_close(struct aim_conn_t *deadconn)
     free(deadconn->priv);
   deadconn->priv = NULL;
   faim_mutex_init(&deadconn->active, NULL);
+  faim_mutex_init(&deadconn->seqnum_lock, NULL);
 }
 
 struct aim_conn_t *aim_getconn_type(struct aim_session_t *sess,
index 8c3a9fb30cbfff1cf1136141806cabf43e4f3500..bdc3b14bf6b0845630271fc99d62fc774245da0c 100644 (file)
@@ -141,7 +141,12 @@ int aim_tx_enqueue__immediate(struct aim_session_t *sess, struct command_tx_stru
  */
 u_int aim_get_next_txseqnum(struct aim_conn_t *conn)
 {
-  return ( ++conn->seqnum );
+  u_int ret;
+  
+  faim_mutex_lock(&conn->seqnum_lock);
+  ret = ++conn->seqnum;
+  faim_mutex_unlock(&conn->seqnum_lock);
+  return ret;
 }
 
 /*
index c15e646b0043f339c2fe80d65b22b052216ec355..6257282437cfd3ad48506daa03dce0d23590fd1f 100644 (file)
@@ -133,9 +133,8 @@ struct aim_conn_t {
   time_t lastactivity; /* time of last transmit */
   int forcedlatency; 
   struct aim_rxcblist_t *handlerlist;
-#ifdef FAIM_USEPTHREADS
-  faim_mutex_t active;
-#endif
+  faim_mutex_t active; /* lock around read/writes */
+  faim_mutex_t seqnum_lock; /* lock around ->seqnum changes */
 };
 
 /* struct for incoming commands */
This page took 0.167104 seconds and 5 git commands to generate.