Skip to content

Commit

Permalink
Optimize native curl (#4101)
Browse files Browse the repository at this point in the history
* reset active_handles when select returns

* defense
  • Loading branch information
matyhtf authored Mar 16, 2021
1 parent 1267b2e commit 62c01b0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion thirdparty/php/curl/curl_multi.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class cURLMulti {
void del_timer() {
if (timer && swoole_timer_is_available()) {
swoole_timer_del(timer);
timer = nullptr;
}
}

Expand Down Expand Up @@ -153,7 +154,9 @@ class cURLMulti {
}

if (selector->active_handles.size() > 0) {
return selector->active_handles.size();
auto count = selector->active_handles.size();
selector->active_handles.clear();
return count;
}

zval _return_value;
Expand Down Expand Up @@ -195,6 +198,7 @@ class cURLMulti {
[this](void *data) {
zval result;
ZVAL_LONG(&result, selector->active_handles.size());
selector->active_handles.clear();
PHPCoroutine::resume_m(selector->context, &result);
},
nullptr);
Expand Down

0 comments on commit 62c01b0

Please sign in to comment.