Minor improvements

pull/13/head
Soner Tari 6 years ago
parent cd78d881c8
commit 3d668aabb6

@ -95,9 +95,9 @@ protopassthrough_engage(pxy_conn_ctx_t *ctx)
// Free any/all data of the previous proto
if (ctx->protoctx->proto_free) {
ctx->protoctx->proto_free(ctx);
// Disable proto_free callback of the previous proto, otherwise it is called while passthrough is closing too
ctx->protoctx->proto_free = NULL;
}
// Disable proto_free callback of the previous proto, or it is called while passthrough is closing too
ctx->protoctx->proto_free = NULL;
ctx->proto = protopassthrough_setup(ctx);
pxy_fd_readcb(ctx->fd, 0, ctx);
@ -420,7 +420,7 @@ protopassthrough_bev_eventcb(struct bufferevent *bev, short events, void *arg)
if (bev == ctx->src.bev) {
protopassthrough_log_connect_src(ctx);
} else if (ctx->connected) {
// @todo Do we need to set dstaddr here? It must have already been set by the original proto.
// @attention dstaddr may not have been set by the original proto.
if (pxy_set_dstaddr(ctx) == -1) {
return;
}

@ -798,7 +798,7 @@ pxy_log_dbg_disconnect_child(pxy_conn_child_ctx_t *ctx)
}
}
#ifdef HAVE_NETFILTER
#ifdef __linux__
/*
* Copied from:
* https://github.com/tmux/tmux/blob/master/compat/getdtablecount.c
@ -819,7 +819,7 @@ getdtablecount()
globfree(&g);
return n;
}
#endif /* HAVE_NETFILTER */
#endif /* __linux__ */
unsigned char *
pxy_malloc_packet(size_t sz, pxy_conn_ctx_t *ctx)
@ -1229,6 +1229,7 @@ int
pxy_set_dstaddr(pxy_conn_ctx_t *ctx)
{
if (sys_sockaddr_str((struct sockaddr *)&ctx->addr, ctx->addrlen, &ctx->dsthost_str, &ctx->dstport_str) != 0) {
// sys_sockaddr_str() may fail due to either malloc() or getnameinfo()
ctx->enomem = 1;
pxy_conn_term(ctx, 1);
return -1;

Loading…
Cancel
Save