- Timestamp:
- Mar 7, 2014, 3:21:30 PM (11 years ago)
- Branches:
- master
- Children:
- 8871953
- Parents:
- 270fd23
- git-author:
- Mike Belopuhov <mike@…> (03/07/14 15:17:23)
- git-committer:
- Mike Belopuhov <mike@…> (03/07/14 15:21:30)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
icbd.c
r270fd23 ra2fadb4 378 378 { 379 379 struct icb_session *is = (struct icb_session *)arg; 380 unsigned char length; 380 381 381 382 while (EVBUFFER_LENGTH(EVBUFFER_INPUT(bev)) > 0) { 382 383 if (is->length == 0) { 383 384 /* read length */ 384 is->rlen = bufferevent_read(bev, is->buffer, 1); 385 is->length = (size_t)(unsigned char)is->buffer[0]; 386 if (is->length == 0) { 385 bufferevent_read(bev, &length, 1); 386 if (length == 0) { 387 /* 388 * An extension has been proposed: 389 * if length is 0, the packet is part of an 390 * "extended packet". The packet should be 391 * treated as if length was 255 and the next 392 * packet received from the sender should be 393 * appended to this packet. 394 * 395 * This server doesn't support this yet. 396 */ 387 397 icbd_drop(is, "invalid packet"); 388 398 return; 389 399 } 400 is->length = (size_t)length; 401 is->rlen = 0; 390 402 } 391 403 /* read as much as we can */ … … 406 418 if (is->rlen < is->length) 407 419 return; 420 /* null-terminate the data */ 421 is->buffer[MIN(is->rlen, ICB_MSGSIZE - 1)] = '\0'; 408 422 /* process the message in full */ 409 423 icb_input(is);
Note:
See TracChangeset
for help on using the changeset viewer.