mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-02 03:47:53 +08:00
connect_monitor: change params for on_refused and on_timeout methods
This commit is contained in:
parent
e4061f8f82
commit
bd32773edc
@ -109,21 +109,19 @@ public:
|
||||
|
||||
/**
|
||||
* 当连接超时时的回调方法,子类可以实现本方法
|
||||
* @param checker {check_client&}
|
||||
* @param addr {const char*} 被检测的服务器地址,格式: ip:port
|
||||
* @param cost {double} 从发起连接请求到超时的时间间隔(秒)
|
||||
*/
|
||||
virtual void on_timeout(const check_client& /* checker */,
|
||||
double /* cost */)
|
||||
virtual void on_timeout(const char* /* addr */, double /* cost */)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 当连接服务器时被拒绝时的回调方法,子类可实现本方法
|
||||
* @param checker {check_client&}
|
||||
* @param addr {const char*} 被检测的服务器地址,格式: ip:port
|
||||
* @param cost {double} 从发起连接请求到被断开的时间间隔(秒)
|
||||
*/
|
||||
virtual void on_refuse(const check_client& /* checker */,
|
||||
double /* cost */)
|
||||
virtual void on_refused(const char* /* addr */, double /* cost */)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ void check_client::close_callback()
|
||||
if (!aliving_) {
|
||||
logger_warn("server: %s dead, spent: %.2f ms",
|
||||
addr_.c_str(), cost);
|
||||
timer_.get_monitor().on_refuse(*this, cost);
|
||||
timer_.get_monitor().on_refuse(addr_.c_str(), cost);
|
||||
}
|
||||
//else
|
||||
// logger("server: %s alive, spent: %.2f ms",
|
||||
@ -81,7 +81,7 @@ bool check_client::timeout_callback()
|
||||
|
||||
logger_warn("server: %s dead, timeout, spent: %.2f ms",
|
||||
addr_.c_str(), cost);
|
||||
timer_.get_monitor().on_timeout(*this, cost);
|
||||
timer_.get_monitor().on_timeout(addr_.c_str(), cost);
|
||||
|
||||
// 连接超时,则直接返回失败
|
||||
return false;
|
||||
|
@ -86,6 +86,7 @@ void check_timer::timer_callback(unsigned int id)
|
||||
if (conn == NULL)
|
||||
{
|
||||
logger_warn("connect server: %s error", addr);
|
||||
monitor_.on_refused(addr, 0);
|
||||
manager.set_pools_status(addr, false);
|
||||
addrs_.erase(cit);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%define release_id 3
|
||||
%define release_id 4
|
||||
|
||||
Summary: The powerful c/c++ library and server framework
|
||||
Name: acl-libs
|
||||
@ -133,10 +133,13 @@ fi
|
||||
|
||||
%changelog
|
||||
|
||||
* Tue Jun 04 2018 zhengshuxin@qiyi.com 3.4.1-4-20180605.14
|
||||
- connect_monitor: change params for on_refused and on_timeout methods
|
||||
|
||||
* Mon Jun 04 2018 zhengshuxin@qiyi.com 3.4.1-3-20180604.18
|
||||
- connect_monitor: add three callback for application to handle
|
||||
|
||||
* Tue May 17 2018 zhengshuxin@qiyi.com 3.4.1-2-20180517.16
|
||||
* Thu May 17 2018 zhengshuxin@qiyi.com 3.4.1-2-20180517.16
|
||||
- fixed bugs in acl_write_wait.c
|
||||
|
||||
* Mon May 14 2018 zhengshuxin@qiyi.com 3.4.1-1-20180514.15
|
||||
@ -152,11 +155,11 @@ fi
|
||||
* Fri Apr 27 2018 zhengshuxin@qiyi.com 3.3.0-90-20180427.27
|
||||
- http: unsafe uri can be corrected
|
||||
|
||||
* Tue Apr 12 2018 zhengshuxin@qiyi.com 3.3.0-89-20180412.20
|
||||
* Thu Apr 12 2018 zhengshuxin@qiyi.com 3.3.0-89-20180412.20
|
||||
- thread_cond::wait: don't save log when waiting timedout
|
||||
- atomic: override constructur of atomic(const atomic&)
|
||||
|
||||
* Mon Mar 20 2018 zhengshuxin@qiyi.com 3.3.0-88-20180320.10
|
||||
* Tue Mar 20 2018 zhengshuxin@qiyi.com 3.3.0-88-20180320.10
|
||||
- fixed one bug in thread_cond::wait there was one problem when computing timeout
|
||||
|
||||
* Thu Mar 15 2018 zhengshuxin@qiyi.com 3.3.0-87-20180315.14
|
||||
|
Loading…
Reference in New Issue
Block a user