| 55 |
|
static int |
| 56 |
|
extract_one_line(struct dbuf_queue *qptr, char *buffer) |
| 57 |
|
{ |
| 58 |
– |
struct dbuf_block *block; |
| 58 |
|
int line_bytes = 0, empty_bytes = 0, phase = 0; |
| 59 |
< |
unsigned int idx; |
| 60 |
< |
|
| 62 |
< |
char c; |
| 63 |
< |
dlink_node *ptr; |
| 59 |
> |
unsigned int idx = 0; |
| 60 |
> |
dlink_node *ptr = NULL; |
| 61 |
|
|
| 62 |
|
/* |
| 63 |
|
* Phase 0: "empty" characters before the line |
| 73 |
|
*/ |
| 74 |
|
DLINK_FOREACH(ptr, qptr->blocks.head) |
| 75 |
|
{ |
| 76 |
< |
block = ptr->data; |
| 76 |
> |
struct dbuf_block *block = ptr->data; |
| 77 |
> |
|
| 78 |
> |
if (ptr == qptr->blocks.head) |
| 79 |
> |
idx = qptr->pos; |
| 80 |
> |
else |
| 81 |
> |
idx = 0; |
| 82 |
|
|
| 83 |
< |
for (idx = 0; idx < block->size; idx++) |
| 83 |
> |
for (; idx < block->size; ++idx) |
| 84 |
|
{ |
| 85 |
< |
c = block->data[idx]; |
| 85 |
> |
char c = block->data[idx]; |
| 86 |
> |
|
| 87 |
|
if (IsEol(c) || (c == ' ' && phase != 1)) |
| 88 |
|
{ |
| 89 |
< |
empty_bytes++; |
| 89 |
> |
++empty_bytes; |
| 90 |
|
if (phase == 1) |
| 91 |
|
phase = 2; |
| 92 |
|
} |
| 116 |
|
dbuf_delete(qptr, line_bytes + empty_bytes); |
| 117 |
|
return IRCD_MIN(line_bytes, IRCD_BUFSIZE - 2); |
| 118 |
|
} |
| 116 |
– |
|
| 119 |
|
/* |
| 120 |
|
* parse_client_queued - parse client queued messages |
| 121 |
|
*/ |
| 334 |
|
return; |
| 335 |
|
} |
| 336 |
|
|
| 337 |
< |
dbuf_put(&client_p->localClient->buf_recvq, readBuf, length); |
| 337 |
> |
dbuf_put_raw(&client_p->localClient->buf_recvq, readBuf, length); |
| 338 |
|
|
| 339 |
|
if (client_p->localClient->lasttime < CurrentTime) |
| 340 |
|
client_p->localClient->lasttime = CurrentTime; |