Skip to content

Commit

Permalink
Merge pull request #1397 from Barenboim/master
Browse files Browse the repository at this point in the history
Switch thread if connection is NULL to prevent stack overflow.
  • Loading branch information
Barenboim authored Oct 17, 2023
2 parents 2acb462 + f4d3c39 commit cb8b236
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/factory/WFTaskFactory.inl
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,10 @@ SubTask *WFComplexClientTask<REQ, RESP, CTX>::done()
}
}

/*
* When target is NULL, it's very likely that we are in the caller's
* thread or DNS thread (dns failed). Running a timer will switch callback
* function to a handler thread, and this can prevent stack overflow.
*/
if (!this->target)
/* When the target or the connection is NULL, it's very likely that we are
* in the caller's thread. Running a timer will switch callback function to
* a handler thread, and this can prevent stack overflow. */
if (!this->target || !this->CommSession::get_connection())
{
auto&& cb = std::bind(&WFComplexClientTask::switch_callback,
this,
Expand Down

0 comments on commit cb8b236

Please sign in to comment.