connect_monitor: change params for on_refused and on_timeout methods

This commit is contained in:
zsx 2018-06-05 14:09:46 +08:00
parent e4061f8f82
commit bd32773edc
4 changed files with 14 additions and 12 deletions

View File

@ -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 */)
{
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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