|
|
|
@ -235,6 +235,7 @@ static void NONNULL(1)
|
|
|
|
|
prototcp_bev_readcb_src(struct bufferevent *bev, void *arg)
|
|
|
|
|
{
|
|
|
|
|
pxy_conn_ctx_t *ctx = arg;
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_readcb_src: ENTER, fd=%d, size=%zu\n",
|
|
|
|
|
ctx->fd, evbuffer_get_length(bufferevent_get_input(bev)));
|
|
|
|
@ -247,15 +248,8 @@ prototcp_bev_readcb_src(struct bufferevent *bev, void *arg)
|
|
|
|
|
|
|
|
|
|
struct evbuffer *inbuf = bufferevent_get_input(bev);
|
|
|
|
|
struct evbuffer *outbuf = bufferevent_get_output(ctx->dst.bev);
|
|
|
|
|
size_t inbuf_size = evbuffer_get_length(inbuf);
|
|
|
|
|
|
|
|
|
|
ctx->thr->intif_in_bytes += inbuf_size;
|
|
|
|
|
|
|
|
|
|
if (pxy_log_content_inbuf(ctx, inbuf, 1) == -1) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t packet_size = inbuf_size;
|
|
|
|
|
size_t packet_size = evbuffer_get_length(inbuf);
|
|
|
|
|
// +2 is for \r\n
|
|
|
|
|
unsigned char *packet = pxy_malloc_packet(packet_size + ctx->header_len + 2, ctx);
|
|
|
|
|
if (!packet) {
|
|
|
|
@ -281,6 +275,7 @@ prototcp_bev_readcb_src(struct bufferevent *bev, void *arg)
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_readcb_src: NEW packet (size=%zu), fd=%d:\n%.*s\n",
|
|
|
|
|
packet_size, ctx->fd, (int)packet_size, packet);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
free(packet);
|
|
|
|
|
pxy_set_watermark(bev, ctx, ctx->dst.bev);
|
|
|
|
|
}
|
|
|
|
@ -289,6 +284,7 @@ static void NONNULL(1)
|
|
|
|
|
prototcp_bev_readcb_dst(struct bufferevent *bev, void *arg)
|
|
|
|
|
{
|
|
|
|
|
pxy_conn_ctx_t *ctx = arg;
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_readcb_dst: ENTER, fd=%d, size=%zu\n",
|
|
|
|
|
ctx->fd, evbuffer_get_length(bufferevent_get_input(bev)));
|
|
|
|
@ -301,17 +297,11 @@ prototcp_bev_readcb_dst(struct bufferevent *bev, void *arg)
|
|
|
|
|
|
|
|
|
|
struct evbuffer *inbuf = bufferevent_get_input(bev);
|
|
|
|
|
struct evbuffer *outbuf = bufferevent_get_output(ctx->src.bev);
|
|
|
|
|
size_t inbuf_size = evbuffer_get_length(inbuf);
|
|
|
|
|
|
|
|
|
|
ctx->thr->intif_out_bytes += inbuf_size;
|
|
|
|
|
|
|
|
|
|
if (pxy_log_content_inbuf(ctx, inbuf, 0) == -1) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_readcb_dst: packet size=%zu, fd=%d\n", inbuf_size, ctx->fd);
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_readcb_dst: packet size=%zu, fd=%d\n", evbuffer_get_length(inbuf), ctx->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
evbuffer_add_buffer(outbuf, inbuf);
|
|
|
|
|
pxy_set_watermark(bev, ctx, ctx->src.bev);
|
|
|
|
|
}
|
|
|
|
@ -332,12 +322,6 @@ prototcp_bev_readcb_src_child(struct bufferevent *bev, void *arg)
|
|
|
|
|
ctx->fd, ctx->conn->fd, evbuffer_get_length(bufferevent_get_input(bev)));
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
if (!ctx->connected) {
|
|
|
|
|
log_err_level_printf(LOG_CRIT, "prototcp_bev_readcb_src_child: readcb called when other end not connected - aborting.\n");
|
|
|
|
|
log_exceptcb();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ctx->dst.closed) {
|
|
|
|
|
pxy_discard_inbuf(bev);
|
|
|
|
|
return;
|
|
|
|
@ -346,11 +330,7 @@ prototcp_bev_readcb_src_child(struct bufferevent *bev, void *arg)
|
|
|
|
|
struct evbuffer *inbuf = bufferevent_get_input(bev);
|
|
|
|
|
struct evbuffer *outbuf = bufferevent_get_output(ctx->dst.bev);
|
|
|
|
|
|
|
|
|
|
size_t inbuf_size = evbuffer_get_length(inbuf);
|
|
|
|
|
|
|
|
|
|
ctx->conn->thr->extif_out_bytes += inbuf_size;
|
|
|
|
|
|
|
|
|
|
size_t packet_size = inbuf_size;
|
|
|
|
|
size_t packet_size = evbuffer_get_length(inbuf);
|
|
|
|
|
unsigned char *packet = pxy_malloc_packet(packet_size, ctx->conn);
|
|
|
|
|
if (!packet) {
|
|
|
|
|
return;
|
|
|
|
@ -371,9 +351,7 @@ prototcp_bev_readcb_src_child(struct bufferevent *bev, void *arg)
|
|
|
|
|
packet_size, ctx->fd, ctx->conn->fd, (int)packet_size, packet);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
pxy_log_content_buf((pxy_conn_ctx_t *)ctx, packet, packet_size, 1);
|
|
|
|
|
free(packet);
|
|
|
|
|
|
|
|
|
|
pxy_set_watermark(bev, ctx->conn, ctx->dst.bev);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -387,12 +365,6 @@ prototcp_bev_readcb_dst_child(struct bufferevent *bev, void *arg)
|
|
|
|
|
ctx->fd, ctx->conn->fd, evbuffer_get_length(bufferevent_get_input(bev)));
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
if (!ctx->connected) {
|
|
|
|
|
log_err_level_printf(LOG_CRIT, "prototcp_bev_readcb_dst_child: readcb called when other end not connected - aborting.\n");
|
|
|
|
|
log_exceptcb();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ctx->src.closed) {
|
|
|
|
|
pxy_discard_inbuf(bev);
|
|
|
|
|
return;
|
|
|
|
@ -400,16 +372,7 @@ prototcp_bev_readcb_dst_child(struct bufferevent *bev, void *arg)
|
|
|
|
|
|
|
|
|
|
struct evbuffer *inbuf = bufferevent_get_input(bev);
|
|
|
|
|
struct evbuffer *outbuf = bufferevent_get_output(ctx->src.bev);
|
|
|
|
|
|
|
|
|
|
size_t inbuf_size = evbuffer_get_length(inbuf);
|
|
|
|
|
|
|
|
|
|
ctx->conn->thr->extif_in_bytes += inbuf_size;
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_readcb_dst_child: dst packet size=%zu, fd=%d\n", inbuf_size, ctx->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
pxy_log_content_inbuf((pxy_conn_ctx_t *)ctx, inbuf, 0);
|
|
|
|
|
evbuffer_add_buffer(outbuf, inbuf);
|
|
|
|
|
|
|
|
|
|
pxy_set_watermark(bev, ctx->conn, ctx->src.bev);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -417,6 +380,7 @@ static void NONNULL(1)
|
|
|
|
|
prototcp_bev_writecb_src(struct bufferevent *bev, void *arg)
|
|
|
|
|
{
|
|
|
|
|
pxy_conn_ctx_t *ctx = arg;
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_writecb_src: ENTER, fd=%d\n", ctx->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
@ -452,6 +416,7 @@ static void NONNULL(1)
|
|
|
|
|
prototcp_bev_writecb_dst(struct bufferevent *bev, void *arg)
|
|
|
|
|
{
|
|
|
|
|
pxy_conn_ctx_t *ctx = arg;
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_writecb_dst: ENTER, fd=%d\n", ctx->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
@ -474,9 +439,11 @@ static void NONNULL(1)
|
|
|
|
|
prototcp_bev_writecb_srv_dst(struct bufferevent *bev, void *arg)
|
|
|
|
|
{
|
|
|
|
|
pxy_conn_ctx_t *ctx = arg;
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_writecb_srv_dst: ENTER, fd=%d\n", ctx->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
pxy_connect_srv_dst(bev, ctx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -624,6 +591,7 @@ prototcp_bev_eventcb_connected_srv_dst(UNUSED struct bufferevent *bev, pxy_conn_
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
ctx->srv_dst_connected = 1;
|
|
|
|
|
|
|
|
|
|
ctx->srv_dst_fd = bufferevent_getfd(ctx->srv_dst.bev);
|
|
|
|
|
ctx->thr->max_fd = MAX(ctx->thr->max_fd, ctx->srv_dst_fd);
|
|
|
|
|
|
|
|
|
@ -635,6 +603,7 @@ prototcp_bev_eventcb_connected_srv_dst(UNUSED struct bufferevent *bev, pxy_conn_
|
|
|
|
|
pxy_conn_free(ctx, 1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ctx->dst_fd = bufferevent_getfd(ctx->dst.bev);
|
|
|
|
|
ctx->thr->max_fd = MAX(ctx->thr->max_fd, ctx->dst_fd);
|
|
|
|
|
|
|
|
|
@ -654,9 +623,8 @@ prototcp_bev_eventcb_eof_src(struct bufferevent *bev, pxy_conn_ctx_t *ctx)
|
|
|
|
|
{
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_eventcb_eof_src: EOF, fd=%d\n", ctx->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
pxy_log_dbg_evbuf_info(ctx, &ctx->src, &ctx->dst);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
if (!ctx->connected) {
|
|
|
|
|
log_err_level_printf(LOG_WARNING, "EOF on outbound connection before connection establishment\n");
|
|
|
|
@ -665,12 +633,12 @@ prototcp_bev_eventcb_eof_src(struct bufferevent *bev, pxy_conn_ctx_t *ctx)
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_eventcb_eof_src: !other->closed, terminate conn, fd=%d\n", ctx->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
pxy_consume_last_input(bev, ctx);
|
|
|
|
|
pxy_try_close_conn_end(&ctx->dst, ctx, &prototcp_bufferevent_free_and_close_fd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pxy_log_dbg_disconnect(ctx);
|
|
|
|
|
|
|
|
|
|
pxy_disconnect(ctx, &ctx->src, ctx->protoctx->bufferevent_free_and_close_fd, &ctx->dst, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -679,9 +647,8 @@ prototcp_bev_eventcb_eof_dst(struct bufferevent *bev, pxy_conn_ctx_t *ctx)
|
|
|
|
|
{
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_eventcb_eof_dst: EOF, fd=%d\n", ctx->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
pxy_log_dbg_evbuf_info(ctx, &ctx->dst, &ctx->src);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
if (!ctx->connected) {
|
|
|
|
|
log_err_level_printf(LOG_WARNING, "EOF on outbound connection before connection establishment\n");
|
|
|
|
@ -690,12 +657,12 @@ prototcp_bev_eventcb_eof_dst(struct bufferevent *bev, pxy_conn_ctx_t *ctx)
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_eventcb_eof_dst: !other->closed, terminate conn, fd=%d\n", ctx->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
pxy_consume_last_input(bev, ctx);
|
|
|
|
|
pxy_try_close_conn_end(&ctx->src, ctx, ctx->protoctx->bufferevent_free_and_close_fd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pxy_log_dbg_disconnect(ctx);
|
|
|
|
|
|
|
|
|
|
pxy_disconnect(ctx, &ctx->dst, &prototcp_bufferevent_free_and_close_fd, &ctx->src, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -724,7 +691,6 @@ prototcp_bev_eventcb_error_src(UNUSED struct bufferevent *bev, pxy_conn_ctx_t *c
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pxy_log_dbg_disconnect(ctx);
|
|
|
|
|
|
|
|
|
|
pxy_disconnect(ctx, &ctx->src, ctx->protoctx->bufferevent_free_and_close_fd, &ctx->dst, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -742,7 +708,6 @@ prototcp_bev_eventcb_error_dst(UNUSED struct bufferevent *bev, pxy_conn_ctx_t *c
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pxy_log_dbg_disconnect(ctx);
|
|
|
|
|
|
|
|
|
|
pxy_disconnect(ctx, &ctx->dst, &prototcp_bufferevent_free_and_close_fd, &ctx->src, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -757,6 +722,7 @@ prototcp_bev_eventcb_error_srv_dst(UNUSED struct bufferevent *bev, pxy_conn_ctx_
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINE, "prototcp_bev_eventcb_error_srv_dst: ERROR !ctx->connected, fd=%d\n", ctx->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
pxy_conn_free(ctx, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -772,10 +738,10 @@ prototcp_bev_eventcb_connected_src_child(UNUSED struct bufferevent *bev, pxy_con
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void NONNULL(1,2)
|
|
|
|
|
prototcp_bev_eventcb_child_connected_dst(UNUSED struct bufferevent *bev, pxy_conn_child_ctx_t *ctx)
|
|
|
|
|
prototcp_bev_eventcb_connected_dst_child(UNUSED struct bufferevent *bev, pxy_conn_child_ctx_t *ctx)
|
|
|
|
|
{
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_eventcb_child_connected_dst: ENTER, fd=%d, conn fd=%d\n", ctx->fd, ctx->conn->fd);
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_eventcb_connected_dst_child: ENTER, fd=%d, conn fd=%d\n", ctx->fd, ctx->conn->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
ctx->connected = 1;
|
|
|
|
@ -797,17 +763,16 @@ prototcp_bev_eventcb_eof_src_child(struct bufferevent *bev, pxy_conn_child_ctx_t
|
|
|
|
|
// @todo How to handle the following case?
|
|
|
|
|
if (!ctx->connected) {
|
|
|
|
|
log_err_level_printf(LOG_WARNING, "EOF on outbound connection before connection establishment\n");
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINER, "prototcp_bev_eventcb_eof_src_child: EOF on outbound connection before connection establishment, fd=%d, conn fd=%d\n", ctx->fd, ctx->conn->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
ctx->dst.closed = 1;
|
|
|
|
|
} else if (!ctx->dst.closed) {
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_eventcb_eof_src_child: !other->closed, terminate conn, fd=%d, conn fd=%d\n", ctx->fd, ctx->conn->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
pxy_consume_last_input_child(bev, ctx);
|
|
|
|
|
pxy_try_close_conn_end(&ctx->dst, ctx->conn, ctx->protoctx->bufferevent_free_and_close_fd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pxy_log_dbg_disconnect_child(ctx);
|
|
|
|
|
pxy_disconnect_child(ctx, &ctx->src, &prototcp_bufferevent_free_and_close_fd, &ctx->dst);
|
|
|
|
|
}
|
|
|
|
@ -823,17 +788,16 @@ prototcp_bev_eventcb_eof_dst_child(struct bufferevent *bev, pxy_conn_child_ctx_t
|
|
|
|
|
// @todo How to handle the following case?
|
|
|
|
|
if (!ctx->connected) {
|
|
|
|
|
log_err_level_printf(LOG_WARNING, "EOF on outbound connection before connection establishment\n");
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINER, "prototcp_bev_eventcb_eof_dst_child: EOF on outbound connection before connection establishment, fd=%d, conn fd=%d\n", ctx->fd, ctx->conn->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
ctx->src.closed = 1;
|
|
|
|
|
} else if (!ctx->src.closed) {
|
|
|
|
|
#ifdef DEBUG_PROXY
|
|
|
|
|
log_dbg_level_printf(LOG_DBG_MODE_FINEST, "prototcp_bev_eventcb_eof_dst_child: !other->closed, terminate conn, fd=%d, conn fd=%d\n", ctx->fd, ctx->conn->fd);
|
|
|
|
|
#endif /* DEBUG_PROXY */
|
|
|
|
|
|
|
|
|
|
pxy_consume_last_input_child(bev, ctx);
|
|
|
|
|
pxy_try_close_conn_end(&ctx->src, ctx->conn, &prototcp_bufferevent_free_and_close_fd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pxy_log_dbg_disconnect_child(ctx);
|
|
|
|
|
pxy_disconnect_child(ctx, &ctx->dst, ctx->protoctx->bufferevent_free_and_close_fd, &ctx->src);
|
|
|
|
|
}
|
|
|
|
@ -856,6 +820,7 @@ prototcp_bev_eventcb_error_src_child(UNUSED struct bufferevent *bev, pxy_conn_ch
|
|
|
|
|
* it after writing what's left in the output buffer */
|
|
|
|
|
pxy_try_close_conn_end(&ctx->dst, ctx->conn, ctx->protoctx->bufferevent_free_and_close_fd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pxy_log_dbg_disconnect_child(ctx);
|
|
|
|
|
pxy_disconnect_child(ctx, &ctx->src, &prototcp_bufferevent_free_and_close_fd, &ctx->dst);
|
|
|
|
|
}
|
|
|
|
@ -878,6 +843,7 @@ prototcp_bev_eventcb_error_dst_child(UNUSED struct bufferevent *bev, pxy_conn_ch
|
|
|
|
|
* it after writing what's left in the output buffer */
|
|
|
|
|
pxy_try_close_conn_end(&ctx->src, ctx->conn, &prototcp_bufferevent_free_and_close_fd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pxy_log_dbg_disconnect_child(ctx);
|
|
|
|
|
pxy_disconnect_child(ctx, &ctx->dst, ctx->protoctx->bufferevent_free_and_close_fd, &ctx->src);
|
|
|
|
|
}
|
|
|
|
@ -902,7 +868,7 @@ prototcp_bev_eventcb_dst_child(struct bufferevent *bev, short events, void *arg)
|
|
|
|
|
pxy_conn_child_ctx_t *ctx = arg;
|
|
|
|
|
|
|
|
|
|
if (events & BEV_EVENT_CONNECTED) {
|
|
|
|
|
prototcp_bev_eventcb_child_connected_dst(bev, ctx);
|
|
|
|
|
prototcp_bev_eventcb_connected_dst_child(bev, ctx);
|
|
|
|
|
} else if (events & BEV_EVENT_EOF) {
|
|
|
|
|
prototcp_bev_eventcb_eof_dst_child(bev, ctx);
|
|
|
|
|
} else if (events & BEV_EVENT_ERROR) {
|
|
|
|
@ -956,13 +922,6 @@ static void NONNULL(1)
|
|
|
|
|
prototcp_bev_readcb(struct bufferevent *bev, void *arg)
|
|
|
|
|
{
|
|
|
|
|
pxy_conn_ctx_t *ctx = arg;
|
|
|
|
|
ctx->atime = time(NULL);
|
|
|
|
|
|
|
|
|
|
if (!ctx->connected) {
|
|
|
|
|
log_err_level_printf(LOG_CRIT, "prototcp_bev_readcb: readcb called when not connected - aborting.\n");
|
|
|
|
|
log_exceptcb();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bev == ctx->src.bev) {
|
|
|
|
|
prototcp_bev_readcb_src(bev, arg);
|
|
|
|
@ -979,7 +938,6 @@ void
|
|
|
|
|
prototcp_bev_writecb(struct bufferevent *bev, void *arg)
|
|
|
|
|
{
|
|
|
|
|
pxy_conn_ctx_t *ctx = arg;
|
|
|
|
|
ctx->atime = time(NULL);
|
|
|
|
|
|
|
|
|
|
if (bev == ctx->src.bev) {
|
|
|
|
|
prototcp_bev_writecb_src(bev, arg);
|
|
|
|
@ -996,12 +954,6 @@ static void NONNULL(1)
|
|
|
|
|
prototcp_bev_eventcb(struct bufferevent *bev, short events, void *arg)
|
|
|
|
|
{
|
|
|
|
|
pxy_conn_ctx_t *ctx = arg;
|
|
|
|
|
ctx->atime = time(NULL);
|
|
|
|
|
|
|
|
|
|
if (events & BEV_EVENT_ERROR) {
|
|
|
|
|
log_err_printf("prototcp_bev_eventcb: Client-side BEV_EVENT_ERROR\n");
|
|
|
|
|
ctx->thr->errors++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bev == ctx->src.bev) {
|
|
|
|
|
prototcp_bev_eventcb_src(bev, events, arg);
|
|
|
|
@ -1018,13 +970,6 @@ static void NONNULL(1)
|
|
|
|
|
prototcp_bev_readcb_child(struct bufferevent *bev, void *arg)
|
|
|
|
|
{
|
|
|
|
|
pxy_conn_child_ctx_t *ctx = arg;
|
|
|
|
|
ctx->conn->atime = time(NULL);
|
|
|
|
|
|
|
|
|
|
if (!ctx->connected) {
|
|
|
|
|
log_err_level_printf(LOG_CRIT, "prototcp_bev_readcb_child: readcb called when not connected - aborting.\n");
|
|
|
|
|
log_exceptcb();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bev == ctx->src.bev) {
|
|
|
|
|
prototcp_bev_readcb_src_child(bev, arg);
|
|
|
|
@ -1039,7 +984,6 @@ void
|
|
|
|
|
prototcp_bev_writecb_child(struct bufferevent *bev, void *arg)
|
|
|
|
|
{
|
|
|
|
|
pxy_conn_child_ctx_t *ctx = arg;
|
|
|
|
|
ctx->conn->atime = time(NULL);
|
|
|
|
|
|
|
|
|
|
if (bev == ctx->src.bev) {
|
|
|
|
|
prototcp_bev_writecb_src_child(bev, arg);
|
|
|
|
@ -1054,12 +998,6 @@ static void NONNULL(1)
|
|
|
|
|
prototcp_bev_eventcb_child(struct bufferevent *bev, short events, void *arg)
|
|
|
|
|
{
|
|
|
|
|
pxy_conn_child_ctx_t *ctx = arg;
|
|
|
|
|
ctx->conn->atime = time(NULL);
|
|
|
|
|
|
|
|
|
|
if (events & BEV_EVENT_ERROR) {
|
|
|
|
|
log_err_printf("Server-side BEV_EVENT_ERROR\n");
|
|
|
|
|
ctx->conn->thr->errors++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bev == ctx->src.bev) {
|
|
|
|
|
prototcp_bev_eventcb_src_child(bev, events, arg);
|
|
|
|
|