Closed adcen0107 closed 2 years ago
网络良好时,很多时候base_packet_id等于acked_packet_id,sender先用base_packet_id 更新sender cache,再拿acked_packet_id查sender cache,这个时候会导致查不到信息,从而更新rtt失败。 int sim_sender_ack(sim_session_t s, sim_sender_t sender, sim_segment_ack_t ack) { int i; sim_segment_t seg; skiplist_iter_t* iter; skiplist_item_t key;
int64_t now_ts; if (ack->acked_packet_id > sender->packet_id_seed || ack->base_packet_id > sender->packet_id_seed) return -1; sim_sender_update_base(s, sender, ack->base_packet_id); //to process nack key.u32 = ack->acked_packet_id; iter = skiplist_search(sender->segs_cache, key); //导致 iter == NULL if (iter != NULL){ seg = (sim_segment_t*)iter->val.ptr; if (now_ts > seg->timestamp + seg->send_ts + sender->first_ts) sim_session_calculate_rtt(s, (uint16_t)(now_ts - seg->timestamp - seg->send_ts - sender->first_ts)); } return 0;
}
计算rtt用的是segs_cache,这个是用时间进行淘汰的,而update base是推进ack cache,不会出现说的网络良好但是找不到对应包的情况。
不好意思,是我的问题,我看的是旧版本代码,sim_sender_update_base的实现会删除包,我看最新代码的函数名一样,以为实现也一样的。
网络良好时,很多时候base_packet_id等于acked_packet_id,sender先用base_packet_id 更新sender cache,再拿acked_packet_id查sender cache,这个时候会导致查不到信息,从而更新rtt失败。 int sim_sender_ack(sim_session_t s, sim_sender_t sender, sim_segment_ack_t ack) { int i; sim_segment_t seg; skiplist_iter_t* iter; skiplist_item_t key;
}