添加发送失败信息记录
This commit is contained in:
@@ -281,8 +281,13 @@ int protu_send(protu_def *p,array_def *data,int timeout_ms)
|
||||
|
||||
|
||||
typedef struct{
|
||||
protu_def *p;
|
||||
array_def *t;
|
||||
protu_def *p;
|
||||
array_def *t;
|
||||
int wnd_tick;// 窗口时间
|
||||
int gap;// 发送循环时间
|
||||
int send_failed_times;// 失败次数
|
||||
uint32_t send_tick_ms;// 发送时的定时器值
|
||||
uint32_t send_end_tick_ms;// 发送时的定时器值
|
||||
}send_pkt_def;
|
||||
|
||||
static void protu_send_later(void *ptr)
|
||||
@@ -309,6 +314,7 @@ static int protu_send_ontime(protu_def *p,send_pkt_def *s)
|
||||
int wnd_tick=((arr_length(s->t)+4)/5+2);
|
||||
int delay=tick%(wnd_tick*(p->num));
|
||||
int gap=p->rank*wnd_tick;
|
||||
int ret=0;
|
||||
if(delay<=gap){
|
||||
delay=gap-delay;
|
||||
}else{
|
||||
@@ -317,10 +323,14 @@ static int protu_send_ontime(protu_def *p,send_pkt_def *s)
|
||||
if(p->silent!=0){
|
||||
// 广播命令在指定时间窗口发送
|
||||
//later_execute(protu_send_later,s,delay);
|
||||
g_send_pkt.wnd_tick=wnd_tick;
|
||||
g_send_pkt.gap=gap;
|
||||
while(p->timer->read(p->timer)<(tick+delay));
|
||||
// protu_send_later(s);
|
||||
return protu_send(s->p,s->t,wnd_tick-1);
|
||||
|
||||
g_send_pkt.send_tick_ms=p->timer->read(p->timer);
|
||||
ret= protu_send(s->p,s->t,wnd_tick-1);
|
||||
g_send_pkt.send_end_tick_ms=p->timer->read(p->timer);
|
||||
return ret;
|
||||
}else{
|
||||
// 单播命令直接发送
|
||||
protu_send_later(s);
|
||||
@@ -328,7 +338,6 @@ static int protu_send_ontime(protu_def *p,send_pkt_def *s)
|
||||
}
|
||||
}
|
||||
|
||||
static int g_send_failed_times;
|
||||
static int protu_send_ontime_loop(protu_def *p,send_pkt_def *s,int retry)
|
||||
{
|
||||
// g_send_failed_times=0;
|
||||
@@ -337,7 +346,7 @@ static int protu_send_ontime_loop(protu_def *p,send_pkt_def *s,int retry)
|
||||
if(protu_send_ontime(p,s)!=0){
|
||||
break;
|
||||
}else{
|
||||
g_send_failed_times++;
|
||||
g_send_pkt.send_failed_times++;
|
||||
}
|
||||
}
|
||||
arr_delete(s->t);
|
||||
@@ -345,11 +354,15 @@ static int protu_send_ontime_loop(protu_def *p,send_pkt_def *s,int retry)
|
||||
}
|
||||
static int send_failed(list_def *argv)
|
||||
{
|
||||
cmd_print("send failed times=%d",g_send_failed_times);
|
||||
cmd_print("send failed times=%d",g_send_pkt.send_failed_times);
|
||||
cmd_print("send_start_tick_ms=%d",g_send_pkt.send_tick_ms);
|
||||
cmd_print("send_end_tick_ms=%d",g_send_pkt.send_end_tick_ms);
|
||||
cmd_print("send_wnd_tick_ms=%d",g_send_pkt.wnd_tick);
|
||||
cmd_print("send_gap_ms=%d",g_send_pkt.gap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
commend_export(send_failed,send_failed,"print send_failed times")
|
||||
commend_export(send_failed,send_failed,"print send_pkt info")
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user