diff --git a/tunnels/client/http2/http2_client.c b/tunnels/client/http2/http2_client.c index 57c285a..d199d1e 100644 --- a/tunnels/client/http2/http2_client.c +++ b/tunnels/client/http2/http2_client.c @@ -218,10 +218,10 @@ static void sendStreamData(http2_client_con_state_t *con, http2_client_child_con http2FrameHdPack(&framehd, rawBufMut(buf)); context_t *data = newContext(con->line); data->payload = buf; - con->current_stream_write_line = stream->line; - lockLine(stream->line); - line_t *h2_line = data->line; + // make sure line is not freed, to be able to pause it + lockLine(stream->line); + con->current_stream_write_line = stream->line; con->tunnel->up->upStream(con->tunnel->up, data); unLockLine(stream->line); if (isAlive(h2_line)) diff --git a/ww/buffer_pool.c b/ww/buffer_pool.c index 45eee03..711e7ad 100644 --- a/ww/buffer_pool.c +++ b/ww/buffer_pool.c @@ -9,6 +9,7 @@ #include // for assert #include #include + // #define BYPASS_BUFFERPOOL #define MEMORY_PROFILE_SMALL (RAM_PROFILE >= kRamProfileM1Memory ? kRamProfileM1Memory : RAM_PROFILE) @@ -157,7 +158,7 @@ static void shrinkSmallBuffers(buffer_pool_t *pool) shift_buffer_t *popBuffer(buffer_pool_t *pool) { #if defined(DEBUG) && defined(BYPASS_BUFFERPOOL) - return newShiftBuffer(pool->large_buffers_default_size); + return newShiftBuffer(pool->shift_buffer_pool,pool->large_buffers_default_size); #endif #if defined(DEBUG) && defined(BUFFER_POOL_DEBUG) pool->in_use += 1; @@ -177,7 +178,7 @@ shift_buffer_t *popBuffer(buffer_pool_t *pool) shift_buffer_t *popSmallBuffer(buffer_pool_t *pool) { #if defined(DEBUG) && defined(BYPASS_BUFFERPOOL) - return newShiftBuffer(pool->small_buffer_size); + return newShiftBuffer(pool->shift_buffer_pool,pool->small_buffers_default_size); #endif #if defined(DEBUG) && defined(BUFFER_POOL_DEBUG) pool->in_use += 1; @@ -197,7 +198,7 @@ shift_buffer_t *popSmallBuffer(buffer_pool_t *pool) void reuseBuffer(buffer_pool_t *pool, shift_buffer_t *b) { #if defined(DEBUG) && defined(BYPASS_BUFFERPOOL) - destroyShiftBuffer(b); + destroyShiftBuffer(pool->shift_buffer_pool,b); return; #endif diff --git a/ww/context_queue.c b/ww/context_queue.c index 67ae0f0..e8845af 100644 --- a/ww/context_queue.c +++ b/ww/context_queue.c @@ -7,6 +7,7 @@ #define i_TYPE queue, context_t * // NOLINT #include "stc/deq.h" + enum { kQCap = 16 @@ -30,8 +31,7 @@ void destroyContextQueue(context_queue_t *self) { if ((*i.ref)->payload != NULL) { - reuseBuffer(getContextBufferPool((*i.ref)), (*i.ref)->payload); - dropContexPayload((*i.ref)); + reuseContextPayload(*i.ref); } destroyContext((*i.ref)); }