version 1.15 | | version 1.16 |
---|
| | |
| | |
/* | | /* |
* static char *rcsid_sockets_c = | | * static char *rcsid_sockets_c = |
* "$Id: lowlevel.c,v 1.15 2006/05/13 21:21:12 akirschbaum Exp $"; | | * "$Id: lowlevel.c,v 1.16 2006/05/21 10:35:11 akirschbaum Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
/** | | /** |
* This reads from fd and puts the data in sl. We return true if we think | | * This reads from fd and puts the data in sl. We return true if we think |
* we have a full packet, 0 if we have a partial packet. The only processing | | * we have a full packet, 0 if we have a partial packet, or -1 if an error |
* we do is remove the intial size value. len (As passed) is the size of the | | * occurred. The only processing we do is remove the initial size value. len |
* buffer allocated in the socklist. We make the assumption the buffer is | | * (As passed) is the size of the buffer allocated in the socklist. We make |
* at least 2 bytes long. | | * the assumption the buffer is at least 2 bytes long. |
*/ | | */ |
| | |
int SockList_ReadPacket(int fd, SockList *sl, int len) | | int SockList_ReadPacket(int fd, SockList *sl, int len) |
| | |
*/ | | */ |
void Send_With_Handling(socket_struct *ns, const SockList *msg) | | void Send_With_Handling(socket_struct *ns, const SockList *msg) |
{ | | { |
unsigned char sbuf[4]; | | unsigned char sbuf[2]; |
| | |
if (ns->status == Ns_Dead || !msg) | | if (ns->status == Ns_Dead || !msg) |
return; | | return; |
| | |
if (msg->len > MAXSOCKBUF) { | | if (msg->len > MAXSOCKSENDBUF) { |
LOG(llevError,"Trying to send a buffer beyond properly size, len =%d\n", | | LOG(llevError,"Trying to send a buffer beyond properly size, len %d > max len %d\n", |
msg->len); | | msg->len, MAXSOCKSENDBUF); |
/* Almost certainly we've overflowed a buffer, so quite now to make | | /* Almost certainly we've overflowed a buffer, so quite now to make |
* it easier to debug. | | * it easier to debug. |
*/ | | */ |