Skip to content

Commit

Permalink
changes on queue
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed Apr 2, 2024
1 parent 8dbc6d0 commit 2dde21c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tunnels/adapters/connector/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ static void on_write_complete(hio_t *io, const void *buf, int writebytes)
if (contextQueueLen(queue) > 0)
{
contextQueuePush(cstate->queue, cpy_ctx);
resume_write_queue(cstate);
if (resume_write_queue(cstate))
hio_setcb_write(io, NULL);
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion tunnels/adapters/tcp_connector/tcp_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ static void on_write_complete(hio_t *io, const void *buf, int writebytes)
if (contextQueueLen(queue) > 0)
{
contextQueuePush(cstate->queue, cpy_ctx);
resume_write_queue(cstate);
if (resume_write_queue(cstate))
hio_setcb_write(io, NULL);
}
else
{
Expand Down
5 changes: 3 additions & 2 deletions tunnels/adapters/tcp_listener/tcp_listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ static void on_write_complete(hio_t *io, const void *buf, int writebytes)
if (contextQueueLen(queue) > 0)
{
contextQueuePush(cstate->queue, cpy_ctx);
resume_write_queue(cstate);
if (resume_write_queue(cstate))
hio_setcb_write(io, NULL);
}
else
{
Expand Down Expand Up @@ -191,7 +192,7 @@ static inline void downStream(tunnel_t *self, context_t *c)
int nwrite = hio_write(cstate->io, rawBuf(c->payload), bytes);
if (nwrite >= 0 && nwrite < bytes)
{
cstate->write_paused = true;
cstate->write_paused = true;
if (c->src_io)
hio_read_stop(c->src_io);
hio_setcb_write(cstate->io, on_write_complete);
Expand Down

0 comments on commit 2dde21c

Please sign in to comment.