Skip to content

Commit

Permalink
tls: respect async connection flag in flb_tls_session_create.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Adair Stewart Whelan <phillip.whelan@chronosphere.io>
  • Loading branch information
pwhelan committed Sep 11, 2024
1 parent 09beb22 commit ecdff84
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/tls/flb_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,8 @@ int flb_tls_session_create(struct flb_tls *tls,
struct flb_tls_session *session;
int result;
char *vhost;
int flag;
int evflag;
int cflag = flb_connection_get_flags(connection);

session = flb_calloc(1, sizeof(struct flb_tls_session));

Expand Down Expand Up @@ -562,13 +563,13 @@ int flb_tls_session_create(struct flb_tls *tls,
goto cleanup;
}

flag = 0;
evflag = 0;

if (result == FLB_TLS_WANT_WRITE) {
flag = MK_EVENT_WRITE;
evflag = MK_EVENT_WRITE;
}
else if (result == FLB_TLS_WANT_READ) {
flag = MK_EVENT_READ;
evflag = MK_EVENT_READ;
}

/*
Expand All @@ -579,7 +580,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 && (cflag & FLB_IO_ASYNC)) {
flb_trace("[io_tls] server handshake connection #%i in process to %s",
connection->fd,
flb_connection_get_remote_address(connection));
Expand Down Expand Up @@ -614,7 +615,7 @@ int flb_tls_session_create(struct flb_tls *tls,
result = mk_event_add(connection->evl,
connection->fd,
FLB_ENGINE_EV_THREAD,
flag,
evflag,
&connection->event);

connection->event.priority = FLB_ENGINE_PRIORITY_CONNECT;
Expand Down

0 comments on commit ecdff84

Please sign in to comment.