diff --git a/src/flb_io.c b/src/flb_io.c index c500011d8e9..698a2452d39 100644 --- a/src/flb_io.c +++ b/src/flb_io.c @@ -109,6 +109,7 @@ int flb_io_net_connect(struct flb_connection *connection, int ret; int async = FLB_FALSE; flb_sockfd_t fd = -1; + int flags = flb_connection_get_flags(connection); // struct flb_upstream *u = u_conn->u; if (connection->fd > 0) { @@ -119,7 +120,7 @@ int flb_io_net_connect(struct flb_connection *connection, } /* Check which connection mode must be done */ - if (coro) { + if (coro && (flags & FLB_IO_ASYNC)) { async = flb_upstream_is_async(connection->upstream); } else { diff --git a/src/tls/flb_tls.c b/src/tls/flb_tls.c index 6377caec783..f00e9b1ae0e 100644 --- a/src/tls/flb_tls.c +++ b/src/tls/flb_tls.c @@ -579,7 +579,7 @@ int flb_tls_session_create(struct flb_tls *tls, * In the other case for an async socket 'th' is NOT NULL so the code * is under a coroutine context and it can yield. */ - if (co == NULL) { + if (co == NULL || !flb_upstream_is_async(connection->upstream)) { flb_trace("[io_tls] server handshake connection #%i in process to %s", connection->fd, flb_connection_get_remote_address(connection));