Better buffer reset

This commit is contained in:
Quentin 2019-05-23 23:13:09 +02:00
parent 7d7b40724c
commit 2d0f285bc2

View file

@ -119,6 +119,7 @@ void mv_buffer_rtof(struct algo_ctx* app_ctx, struct evt_core_fdinfo* from) {
bp->mode = BP_READING;
bp->aread = 0;
bp->ap_count = 0;
g_queue_push_tail (app_ctx->free_buffer, bp);
g_hash_table_remove(app_ctx->used_buffer, &(from->fd));
}
@ -131,6 +132,7 @@ void mv_buffer_wtof(struct algo_ctx* app_ctx, struct evt_core_fdinfo* fdinfo) {
}
bp->mode = BP_READING;
bp->aread = 0;
bp->ap_count = 0;
g_queue_push_tail (app_ctx->free_buffer, bp);
g_hash_table_remove(app_ctx->used_buffer, &(fdinfo->fd));
}
@ -187,6 +189,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;
// 3. We move it
g_hash_table_remove (app_ctx->application_waiting, from);