Skip to content

Commit 0665dd9

Browse files
authored
input: disable coroutines for custom events and input callbacks that 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 <[email protected]>
1 parent db27a84 commit 0665dd9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/flb_io.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ int flb_io_net_connect(struct flb_connection *connection,
109109
int ret;
110110
int async = FLB_FALSE;
111111
flb_sockfd_t fd = -1;
112+
int flags = flb_connection_get_flags(connection);
112113
// struct flb_upstream *u = u_conn->u;
113114

114115
if (connection->fd > 0) {
@@ -119,7 +120,7 @@ int flb_io_net_connect(struct flb_connection *connection,
119120
}
120121

121122
/* Check which connection mode must be done */
122-
if (coro) {
123+
if (coro && (flags & FLB_IO_ASYNC)) {
123124
async = flb_upstream_is_async(connection->upstream);
124125
}
125126
else {

src/tls/flb_tls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ int flb_tls_session_create(struct flb_tls *tls,
579579
* In the other case for an async socket 'th' is NOT NULL so the code
580580
* is under a coroutine context and it can yield.
581581
*/
582-
if (co == NULL) {
582+
if (co == NULL || !flb_upstream_is_async(connection->upstream)) {
583583
flb_trace("[io_tls] server handshake connection #%i in process to %s",
584584
connection->fd,
585585
flb_connection_get_remote_address(connection));

0 commit comments

Comments
 (0)