* 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;
}
*/
if (generic[0] != 0x2a) {
faimdprintf(1, "Bad incoming data!");
+ aim_conn_close(conn);
faim_mutex_unlock(&conn->active);
return -1;
}
}
/* 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;
}