Skip to content

Commit

Permalink
input: disable coroutines for custom events and input callbacks that …
Browse files Browse the repository at this point in the history
…do not support coroutines. (#9338)

* io: respect async connection flag in flb_io_net_connect.
* tls: respect async connection flag in flb_tls_session_create.

Signed-off-by: Phillip Adair Stewart Whelan <phillip.whelan@chronosphere.io>
  • Loading branch information
pwhelan committed Sep 16, 2024
1 parent db27a84 commit 0665dd9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/flb_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/tls/flb_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 0665dd9

Please sign in to comment.