diff --git a/src/algo_utils.c b/src/algo_utils.c
index 216d992..50e1336 100644
--- a/src/algo_utils.c
+++ b/src/algo_utils.c
@@ -120,12 +120,9 @@ void mv_buffer_rtof(struct algo_ctx* app_ctx, struct evt_core_fdinfo* from) {
bp = g_hash_table_lookup (app_ctx->used_buffer, &from->fd);
if (bp == NULL) {
fprintf(stderr, "Unable to find a buffer for fd=%d url=%s", from->fd, from->url);
- exit(EXIT_FAILURE);
}
- bp->mode = BP_READING;
- bp->aread = 0;
- bp->ap_count = 0;
+ memset(bp, 0, sizeof(struct buffer_packet));
g_queue_push_tail (app_ctx->free_buffer, bp);
g_hash_table_remove(app_ctx->used_buffer, &(from->fd));
}
@@ -134,11 +131,8 @@ void mv_buffer_wtof(struct algo_ctx* app_ctx, struct evt_core_fdinfo* fdinfo) {
struct buffer_packet* bp = g_hash_table_lookup (app_ctx->used_buffer, &(fdinfo->fd));
if (bp == NULL) {
fprintf(stderr, "Unable to find a buffer for fd=%d url=%s", fdinfo->fd, fdinfo->url);
- exit(EXIT_FAILURE);
}
- bp->mode = BP_READING;
- bp->aread = 0;
- bp->ap_count = 0;
+ memset(bp, 0, sizeof(struct buffer_packet));
g_queue_push_tail (app_ctx->free_buffer, bp);
g_hash_table_remove(app_ctx->used_buffer, &(fdinfo->fd));
}
@@ -148,7 +142,6 @@ void mv_buffer_rtoa(struct algo_ctx* app_ctx, struct evt_core_fdinfo* from, void
bp = g_hash_table_lookup (app_ctx->used_buffer, &from->fd);
if (bp == NULL) {
fprintf(stderr, "Unable to find a buffer for fd=%d url=%s\n", from->fd, from->url);
- exit(EXIT_FAILURE);
}
g_hash_table_remove(app_ctx->used_buffer, &from->fd);
if (g_hash_table_contains(app_ctx->application_waiting, to)) {
@@ -193,9 +186,7 @@ void mv_buffer_atof(struct algo_ctx* app_ctx, void* from) {
}
// 2. Reset it
- bp->mode = BP_READING;
- bp->aread = 0;
- bp->ap_count = 0;
+ memset(bp, 0, sizeof(struct buffer_packet));
// 3. We move it
g_hash_table_remove (app_ctx->application_waiting, from);
diff --git a/src/packet.c b/src/packet.c
index 71791bc..12d2a8b 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -143,7 +143,7 @@ void dump_abstract_packet(union abstract_packet* ap) {
printf(" size=%d, cmd=%d\n", ap->fmt.headers.size, ap->fmt.headers.cmd);
switch (ap->fmt.headers.cmd) {
case CMD_HEALTH:
- printf(" id=%d, deltat=%d, prevlink=%d, min_blocked_pkt=%d, bitfield=%08x\n",
+ printf(" id=%d, deltat=%d, prevlink=%d, min_blocked_pkt=%d, bitfield=%02x\n",
ap->fmt.content.health.id,
ap->fmt.content.health.deltat,
ap->fmt.content.health.prevlink,