improve heartbeat

This commit is contained in:
wangyu- 2017-11-11 01:07:28 -06:00
parent 24310edd35
commit 9e010c7f97
2 changed files with 12 additions and 2 deletions

View File

@ -711,7 +711,17 @@ int parse_safer(conn_info_t &conn_info,const char * input,int input_len,char &ty
conn_info.oppsite_roller=roller;
conn_info.last_oppsite_roller_time=get_current_time();
}
conn_info.my_roller++;//increase on a successful recv
if(hb_mode==0)
conn_info.my_roller++;//increase on a successful recv
else if(hb_mode==1)
{
if(type=='h')
conn_info.my_roller++;
}
else
{
assert(0==1);
}
if(after_recv_raw0(conn_info.raw_info)!=0) return -1;

View File

@ -439,7 +439,7 @@ int client_on_raw_recv(conn_info_t &conn_info) //called when raw fd received a p
}
if(data_len>=0&&type=='h')
{
mylog(log_debug,"[hb]heart beat received\n");
mylog(log_debug,"[hb]heart beat received,oppsite_roller=%d\n",int(conn_info.oppsite_roller));
conn_info.last_hb_recv_time=get_current_time();
return 0;
}