libfaim/aim_txqueue.c

changeset 889
070eb1c6db95
parent 840
b80a628d935f
child 900
c560f793f30c
equal deleted inserted replaced
888:291963d9d83f 889:070eb1c6db95
4 * Herein lies all the mangement routines for the transmit (Tx) queue. 4 * Herein lies all the mangement routines for the transmit (Tx) queue.
5 * 5 *
6 */ 6 */
7 7
8 #include <faim/aim.h> 8 #include <faim/aim.h>
9
10 #ifndef _WIN32
11 #include <sys/socket.h>
12 #endif
9 13
10 /* 14 /*
11 * Allocate a new tx frame. 15 * Allocate a new tx frame.
12 * 16 *
13 * This is more for looks than anything else. 17 * This is more for looks than anything else.
17 * 21 *
18 * framing = AIM_FRAMETYPE_OFT/OSCAR 22 * framing = AIM_FRAMETYPE_OFT/OSCAR
19 * chan = channel for OSCAR, hdrtype for OFT 23 * chan = channel for OSCAR, hdrtype for OFT
20 * 24 *
21 */ 25 */
22 faim_internal struct command_tx_struct *aim_tx_new(unsigned short framing, int chan, struct aim_conn_t *conn, int datalen) 26 faim_internal struct command_tx_struct *aim_tx_new(unsigned char framing, int chan, struct aim_conn_t *conn, int datalen)
23 { 27 {
24 struct command_tx_struct *new; 28 struct command_tx_struct *new;
25 29
26 if (!conn) { 30 if (!conn) {
27 printf("aim_tx_new: ERROR: no connection specified\n"); 31 printf("aim_tx_new: ERROR: no connection specified\n");
284 * For OSCAR, a full image of the raw packet data now in curPacket. 288 * For OSCAR, a full image of the raw packet data now in curPacket.
285 * For OFT, an image of just the bloated header is in curPacket, 289 * For OFT, an image of just the bloated header is in curPacket,
286 * since OFT allows us to do the data in a different write (yay!). 290 * since OFT allows us to do the data in a different write (yay!).
287 */ 291 */
288 faim_mutex_lock(&cur->conn->active); 292 faim_mutex_lock(&cur->conn->active);
289 if ( (u_int)write(cur->conn->fd, curPacket, buflen) != buflen) { 293 if (send(cur->conn->fd, curPacket, buflen, 0) != buflen) {
290 faim_mutex_unlock(&cur->conn->active); 294 faim_mutex_unlock(&cur->conn->active);
291 cur->sent = 1; 295 cur->sent = 1;
292 aim_conn_kill(sess, &cur->conn); 296 aim_conn_kill(sess, &cur->conn);
293 return 0; /* bail out */ 297 return 0; /* bail out */
294 } 298 }
295 299
296 if ((cur->hdrtype == AIM_FRAMETYPE_OFT) && cur->commandlen) { 300 if ((cur->hdrtype == AIM_FRAMETYPE_OFT) && cur->commandlen) {
297 if (write(cur->conn->fd, cur->data, cur->commandlen) != cur->commandlen) { 301 if (send(cur->conn->fd, cur->data, cur->commandlen, 0) != (int)cur->commandlen) {
298 /* 302 /*
299 * Theres nothing we can do about this since we've already sent the 303 * Theres nothing we can do about this since we've already sent the
300 * header! The connection is unstable. 304 * header! The connection is unstable.
301 */ 305 */
302 } 306 }

mercurial