diff options
| author | zhangchengwei <[email protected]> | 2019-04-28 13:23:46 +0800 |
|---|---|---|
| committer | zhangchengwei <[email protected]> | 2019-04-28 13:23:46 +0800 |
| commit | b5027d04aacdac1f2c0b0486a4c3a3fd9ef62e99 (patch) | |
| tree | 7fb5301e88c03066257afa81187c65a4c365e005 | |
| parent | e54f850d9fe923b5a561fd6e5bbbb4a2317bf314 (diff) | |
bugfix: 测试中发现,当发起GET操作时,有部分HIT有部分MISS时,在传输完毕后当前正在进行的curl handle数得不到更新,触发session限制。feature-cache-client
| -rw-r--r-- | cache/src/tango_cache_client.cpp | 4 | ||||
| -rw-r--r-- | cache/src/tango_cache_client_in.h | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/cache/src/tango_cache_client.cpp b/cache/src/tango_cache_client.cpp index 3df1dfd..8a62350 100644 --- a/cache/src/tango_cache_client.cpp +++ b/cache/src/tango_cache_client.cpp @@ -927,6 +927,10 @@ static int curl_timer_function_cb(CURLM *multi, long timeout_ms, void *userp) } else if(timeout_ms == -1) //timeout_ms is -1 means we should delete the timer. { + //call curl_multi_socket_action to update multidata->sessions, otherwise it will not be updated to 0 + //when all transfers complete in some occasions(eg, GET, some objects hited while ohters miss). + rc = curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, 0, &still_running); + multidata->sessions = still_running; evtimer_del(&multidata->timer_event); } else //update the timer to the new value. diff --git a/cache/src/tango_cache_client_in.h b/cache/src/tango_cache_client_in.h index 3285280..330ac55 100644 --- a/cache/src/tango_cache_client_in.h +++ b/cache/src/tango_cache_client_in.h @@ -143,7 +143,7 @@ struct tango_cache_parameter struct minio_multihd_data { - long long sessions; //��ǰ���ڽ���GET/PUT�ĻỰ�� + volatile long long sessions; //��ǰ���ڽ���GET/PUT�ĻỰ�� CURLM *multi_hd; struct event timer_event; struct event_base* evbase; @@ -160,7 +160,6 @@ struct tango_cache_instance char redisaddr[128]; map<string, minio_multihd_data*> *minio_hosts; - struct minio_multihd_data multidata; const struct tango_cache_parameter *param; void *runtime_log; struct cache_statistics statistic; |
