comparison libfaim/aim_rxqueue.c @ 279:501e09c51cbc

[gaim-migrate @ 289] Updates to libfaim -> updates to gaim. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 29 May 2000 20:30:48 +0000
parents 6ced2f1c8b24
children 0f14e6d8a51b
comparison
equal deleted inserted replaced
278:29e1669b006b 279:501e09c51cbc
29 * 0 char -- Always 0x2a 29 * 0 char -- Always 0x2a
30 * 1 char -- Channel ID. Usually 2 -- 1 and 4 are used during login. 30 * 1 char -- Channel ID. Usually 2 -- 1 and 4 are used during login.
31 * 2 short -- Sequence number 31 * 2 short -- Sequence number
32 * 4 short -- Number of data bytes that follow. 32 * 4 short -- Number of data bytes that follow.
33 */ 33 */
34 faim_mutex_lock(&conn->active);
34 if (read(conn->fd, generic, 6) < 6){ 35 if (read(conn->fd, generic, 6) < 6){
35 aim_conn_close(conn); 36 aim_conn_close(conn);
37 faim_mutex_unlock(&conn->active);
36 return -1; 38 return -1;
37 } 39 }
40 faim_mutex_unlock(&conn->active);
38 41
39 /* 42 /*
40 * This shouldn't happen unless the socket breaks, the server breaks, 43 * This shouldn't happen unless the socket breaks, the server breaks,
41 * or we break. We must handle it just in case. 44 * or we break. We must handle it just in case.
42 */ 45 */
70 free(newrx); 73 free(newrx);
71 return -1; 74 return -1;
72 } 75 }
73 76
74 /* read the data portion of the packet */ 77 /* read the data portion of the packet */
78 faim_mutex_lock(&conn->active);
75 if (read(conn->fd, newrx->data, newrx->commandlen) < newrx->commandlen){ 79 if (read(conn->fd, newrx->data, newrx->commandlen) < newrx->commandlen){
76 free(newrx->data); 80 free(newrx->data);
77 free(newrx); 81 free(newrx);
78 aim_conn_close(conn); 82 aim_conn_close(conn);
83 faim_mutex_unlock(&conn->active);
79 return -1; 84 return -1;
80 } 85 }
86 faim_mutex_unlock(&conn->active);
81 87
82 newrx->conn = conn; 88 newrx->conn = conn;
83 89
84 newrx->next = NULL; /* this will always be at the bottom */ 90 newrx->next = NULL; /* this will always be at the bottom */
85 newrx->lock = 0; /* unlock */ 91 newrx->lock = 0; /* unlock */