casual squidding

This commit is contained in:
mallocnull 2017-10-30 17:00:10 -05:00
parent a3ca956036
commit d9370d195a
3 changed files with 17 additions and 7 deletions

View file

@ -36,7 +36,7 @@ void packet_context_register(uint8_t direction, uint8_t id, uint8_t iter_pt, uin
va_start(args, count); va_start(args, count);
for(i = 0; i < count; ++i) { for(i = 0; i < count; ++i) {
uint16_t length = va_arg(args, uint16_t); uint16_t length = va_arg(args, int);
ptr[id].region_lengths[i] = length; ptr[id].region_lengths[i] = length;
ptr[id].length += length; ptr[id].length += length;
} }
@ -44,9 +44,13 @@ void packet_context_register(uint8_t direction, uint8_t id, uint8_t iter_pt, uin
} }
void packet_context_free() { void packet_context_free() {
free(ctx.c2s.region_lengths); int i;
for(i = 0; i < ctx.count; ++i)
free(ctx.c2s[i].region_lengths);
free(ctx.c2s); free(ctx.c2s);
free(ctx.s2c.region_lengths); for(i = 0; i < ctx.count; ++i)
free(ctx.s2c[i].region_lengths);
free(ctx.s2c); free(ctx.s2c);
} }

View file

@ -25,10 +25,14 @@ struct packet_t {
}; };
void packet_context_init(uint8_t); void packet_context_init(uint8_t);
void packet_context_register(uint8_t, uint8_t, uint8_t, uint8_t, ...);
void packet_context_register(uint8_t, uint8_t, uint8_t, ...);
void packet_context_register_iter(uint8_t, uint8_t, uint8_t, uint8_t, ...);
void packet_context_free(); void packet_context_free();
packet_t* packet_init_in(uint8_t*);
packet_t* packet_init_out(uint8_t);
void packet_free(packet_t*);
#endif #endif

View file

@ -2,6 +2,8 @@
#define SERVER_H #define SERVER_H
#include <stdio.h> #include <stdio.h>
#include "context.h"
#include "user.h"
#include "sock.h" #include "sock.h"
#include "queue.h" #include "queue.h"
#include "flimit.h" #include "flimit.h"