]> andersk Git - libfaim.git/blobdiff - aim_rxqueue.c
- Sat Sep 2 23:42:37 UTC 2000
[libfaim.git] / aim_rxqueue.c
index 75aa8bcdef2d4fafb13b45695d92095564732aa7..72f4481b392fb829feda20628cf9676ba0c5d65d 100644 (file)
@@ -41,8 +41,8 @@ int aim_get_command(struct aim_session_t *sess, struct aim_conn_t *conn)
    *   4 short -- Number of data bytes that follow.
    */
   faim_mutex_lock(&conn->active);
-  if (read(conn->fd, generic, 6) < 6){
-    aim_conn_kill(sess, &conn);
+  if (recv(conn->fd, generic, 6, MSG_WAITALL) < 6){
+    aim_conn_close(conn);
     faim_mutex_unlock(&conn->active);
     return -1;
   }
@@ -53,6 +53,7 @@ int aim_get_command(struct aim_session_t *sess, struct aim_conn_t *conn)
    */
   if (generic[0] != 0x2a) {
     faimdprintf(1, "Bad incoming data!");
+    aim_conn_close(conn);
     faim_mutex_unlock(&conn->active);
     return -1;
   }    
@@ -88,10 +89,10 @@ int aim_get_command(struct aim_session_t *sess, struct aim_conn_t *conn)
   }
 
   /* read the data portion of the packet */
-  if (read(conn->fd, newrx->data, newrx->commandlen) < newrx->commandlen){
+  if (recv(conn->fd, newrx->data, newrx->commandlen, MSG_WAITALL) < newrx->commandlen){
     free(newrx->data);
     free(newrx);
-    aim_conn_kill(sess, &conn);
+    aim_conn_close(conn);
     faim_mutex_unlock(&conn->active);
     return -1;
   }
This page took 0.031913 seconds and 4 git commands to generate.