packet.c fixed
This commit is contained in:
parent
32db3450e8
commit
dbd98a0a38
29
src/packet.c
29
src/packet.c
|
@ -228,7 +228,7 @@ flood_recalc(void *unused)
|
||||||
* read_packet - Read a 'packet' of data from a connection and process it.
|
* read_packet - Read a 'packet' of data from a connection and process it.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
read_packet(int fd, void *data)
|
read_packet(rb_fde_t * F, void *data)
|
||||||
{
|
{
|
||||||
struct Client *client_p = data;
|
struct Client *client_p = data;
|
||||||
struct LocalUser *lclient_p = client_p->localClient;
|
struct LocalUser *lclient_p = client_p->localClient;
|
||||||
|
@ -239,6 +239,9 @@ read_packet(int fd, void *data)
|
||||||
#ifdef USE_IODEBUG_HOOKS
|
#ifdef USE_IODEBUG_HOOKS
|
||||||
hook_data_int hdata;
|
hook_data_int hdata;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
if(IsAnyDead(client_p))
|
if(IsAnyDead(client_p))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -247,16 +250,20 @@ read_packet(int fd, void *data)
|
||||||
* I personally think it makes the code too hairy to make sane.
|
* I personally think it makes the code too hairy to make sane.
|
||||||
* -- adrian
|
* -- adrian
|
||||||
*/
|
*/
|
||||||
length = client_p->localClient->F->read_impl(client_p->localClient->F, readBuf, READBUF_SIZE);
|
length = rb_read(client_p->localClient->F, readBuf, READBUF_SIZE);
|
||||||
|
|
||||||
if(length <= 0)
|
if(length <= 0)
|
||||||
{
|
{
|
||||||
if((length == -1) && ignoreErrno(errno))
|
if(rb_ignore_errno(errno))
|
||||||
{
|
{
|
||||||
rb_setselect(client_p->localClient->F->fd, FDLIST_IDLECLIENT,
|
rb_setselect(client_p->localClient->F,
|
||||||
COMM_SELECT_READ, read_packet, client_p, 0);
|
RB_SELECT_READ, read_packet, client_p);
|
||||||
|
} else
|
||||||
|
error_exit_client(client_p, length);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(length == 0)
|
||||||
|
{
|
||||||
error_exit_client(client_p, length);
|
error_exit_client(client_p, length);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -304,16 +311,12 @@ read_packet(int fd, void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we get here, we need to register for another COMM_SELECT_READ */
|
/* bail if short read */
|
||||||
if(PARSE_AS_SERVER(client_p))
|
if(length < READBUF_SIZE)
|
||||||
{
|
{
|
||||||
rb_setselect(client_p->localClient->F->fd, FDLIST_SERVER, COMM_SELECT_READ,
|
rb_setselect(client_p->localClient->F, RB_SELECT_READ, read_packet, client_p);
|
||||||
read_packet, client_p, 0);
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
rb_setselect(client_p->localClient->F->fd, FDLIST_IDLECLIENT,
|
|
||||||
COMM_SELECT_READ, read_packet, client_p, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue