Fix another stupid bug
This commit is contained in:
parent
a9e5267495
commit
eb7b3a4712
1 changed files with 5 additions and 5 deletions
10
src/packet.c
10
src/packet.c
|
@ -47,7 +47,7 @@ union abstract_packet* buffer_append_ap(struct buffer_packet* bp, union abstract
|
|||
|
||||
enum FD_STATE read_packet_from_tcp(struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp) {
|
||||
ssize_t nread = 0, ap_aread = 0, cur_ap_aread = 0;
|
||||
union abstract_packet* ap = (union abstract_packet*) &bp->ip;
|
||||
union abstract_packet* ap = buffer_first_ap (bp);
|
||||
size_t pkt_size_size = sizeof(ap->fmt.headers.size);
|
||||
if (bp->mode != BP_READING) return FDS_ERR;
|
||||
|
||||
|
@ -55,7 +55,8 @@ enum FD_STATE read_packet_from_tcp(struct evt_core_fdinfo* fdinfo, struct buffer
|
|||
do {
|
||||
|
||||
//fprintf(stderr, "bp->ap_count=%d\n", bp->ap_count);
|
||||
ap = (union abstract_packet*) &bp->ip;
|
||||
ap = buffer_first_ap (bp);
|
||||
ap_aread = 0;
|
||||
for (int i = 0; i < bp->ap_count; i++) {
|
||||
ap_aread += ap->fmt.headers.size;
|
||||
ap = ap_next (ap);
|
||||
|
@ -84,6 +85,7 @@ enum FD_STATE read_packet_from_tcp(struct evt_core_fdinfo* fdinfo, struct buffer
|
|||
|
||||
bp->ap_count++;
|
||||
//fprintf(stderr, "bp->ap_count=%d, buffer_count_ap(bp)=%ld\n", bp->ap_count, buffer_count_ap (bp));
|
||||
//dump_buffer_packet (bp);
|
||||
} while (bp->ap_count != buffer_count_ap (bp));
|
||||
|
||||
bp->mode = BP_WRITING;
|
||||
|
@ -196,10 +198,8 @@ enum FD_STATE read_packet_from_udp (struct evt_core_fdinfo* fdinfo, struct buffe
|
|||
void dump_buffer_packet(struct buffer_packet* bp) {
|
||||
printf("<Buffer Packet>\n");
|
||||
printf(" mode=%d, aread=%d, awrite=%d, ap_count=%d, usage=%ld/%ld\n", bp->mode, bp->aread, bp->awrite, bp->ap_count, buffer_full_size (bp), sizeof(bp->ip));
|
||||
union abstract_packet* ap = (union abstract_packet*) &bp->ip;
|
||||
for (int i = 0; i < bp->ap_count; i++) {
|
||||
for (union abstract_packet* ap = buffer_first_ap (bp); ap != NULL; ap = ap_next (ap)) {
|
||||
dump_abstract_packet(ap);
|
||||
ap = (union abstract_packet*)(&ap->raw + ap->fmt.headers.size);
|
||||
}
|
||||
printf("</Buffer Packet>\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue