diff --git a/net/net_tcp.c b/net/net_tcp.c index deae6b8b99c..fff9aab4aec 100644 --- a/net/net_tcp.c +++ b/net/net_tcp.c @@ -898,8 +898,10 @@ static struct tcp_connection* tcpconn_new(int sock, union sockaddr_union* su, c->async->allocated = protos[si->proto].net.async_chunks; c->async->oldest = 0; c->async->pending = 0; - } else - LM_WARN("could not allocate async data for con!\n"); + } else { + LM_ERR("could not allocate async data for con!\n"); + goto error; + } } tcp_connections_no++; diff --git a/net/proto_tcp/proto_tcp.c b/net/proto_tcp/proto_tcp.c index e9b87a73c9c..f6be72a29a9 100644 --- a/net/proto_tcp/proto_tcp.c +++ b/net/proto_tcp/proto_tcp.c @@ -217,8 +217,13 @@ static int proto_tcp_init(struct proto_info *pi) } /* without async support, there is nothing to init/clean per conn */ - if (tcp_async!=0) + if (tcp_async!=0) { + /* be sure the settings are consistent, like having a minimum 2 value + * if the tcp_async is enbled */ + if (tcp_async_max_postponed_chunks<=1) + tcp_async_max_postponed_chunks = 2; pi->net.async_chunks= tcp_async_max_postponed_chunks; + } return 0; }