File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,10 @@ class Multi {
108
108
curl_multi_setopt (multi_handle_, CURLMOPT_TIMERDATA, this );
109
109
}
110
110
111
+ ~Multi () {
112
+ curl_multi_cleanup (multi_handle_);
113
+ }
114
+
111
115
CURLM *get_multi_handle () {
112
116
return multi_handle_;
113
117
}
Original file line number Diff line number Diff line change @@ -2691,6 +2691,13 @@ void _php_curl_free(php_curl *ch) {
2691
2691
curl_easy_setopt (ch->cp , CURLOPT_HEADERFUNCTION, curl_write_nothing);
2692
2692
curl_easy_setopt (ch->cp , CURLOPT_WRITEFUNCTION, curl_write_nothing);
2693
2693
2694
+ swoole::curl::Handle *handle = nullptr ;
2695
+ curl_easy_getinfo (ch->cp , CURLINFO_PRIVATE, &handle);
2696
+
2697
+ if (handle && handle->multi ) {
2698
+ handle->multi ->remove_handle (ch);
2699
+ }
2700
+
2694
2701
/* cURL destructors should be invoked only by last curl handle */
2695
2702
if (--(*ch->clone ) == 0 ) {
2696
2703
zend_llist_clean (&ch->to_free ->str );
@@ -2701,8 +2708,6 @@ void _php_curl_free(php_curl *ch) {
2701
2708
efree (ch->to_free );
2702
2709
efree (ch->clone );
2703
2710
2704
- swoole::curl::Handle *handle = nullptr ;
2705
- curl_easy_getinfo (ch->cp , CURLINFO_PRIVATE, &handle);
2706
2711
delete handle;
2707
2712
curl_easy_setopt (ch->cp , CURLOPT_PRIVATE, nullptr );
2708
2713
}
Original file line number Diff line number Diff line change @@ -731,7 +731,6 @@ static void _php_curl_multi_free(php_curlm *mh) {
731
731
mh->multi ->remove_handle (ch->cp );
732
732
}
733
733
}
734
- curl_multi_cleanup (mh->multi ->get_multi_handle ());
735
734
zend_llist_clean (&mh->easyh );
736
735
if (mh->handlers ->server_push ) {
737
736
zval_ptr_dtor (&mh->handlers ->server_push ->func_name );
You can’t perform that action at this time.
0 commit comments