diff options
Diffstat (limited to 'toxav/bwcontroller.c')
-rw-r--r-- | toxav/bwcontroller.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/toxav/bwcontroller.c b/toxav/bwcontroller.c index 460cf118..695bb99b 100644 --- a/toxav/bwcontroller.c +++ b/toxav/bwcontroller.c | |||
@@ -83,7 +83,7 @@ BWController *bwc_new(Messenger *m, uint32_t friendnumber, m_cb *mcb, void *mcb_ | |||
83 | retu->mcb_user_data = mcb_user_data; | 83 | retu->mcb_user_data = mcb_user_data; |
84 | retu->m = m; | 84 | retu->m = m; |
85 | retu->friend_number = friendnumber; | 85 | retu->friend_number = friendnumber; |
86 | uint64_t now = current_time_monotonic(); | 86 | uint64_t now = current_time_monotonic(m->mono_time); |
87 | retu->cycle.last_sent_timestamp = now; | 87 | retu->cycle.last_sent_timestamp = now; |
88 | retu->cycle.last_refresh_timestamp = now; | 88 | retu->cycle.last_refresh_timestamp = now; |
89 | retu->rcvpkt.rb = rb_new(BWC_AVG_PKT_COUNT); | 89 | retu->rcvpkt.rb = rb_new(BWC_AVG_PKT_COUNT); |
@@ -138,7 +138,7 @@ void bwc_add_recv(BWController *bwc, uint32_t recv_bytes) | |||
138 | void send_update(BWController *bwc) | 138 | void send_update(BWController *bwc) |
139 | { | 139 | { |
140 | if (bwc->packet_loss_counted_cycles > BWC_AVG_LOSS_OVER_CYCLES_COUNT && | 140 | if (bwc->packet_loss_counted_cycles > BWC_AVG_LOSS_OVER_CYCLES_COUNT && |
141 | current_time_monotonic() - bwc->cycle.last_sent_timestamp > BWC_SEND_INTERVAL_MS) { | 141 | current_time_monotonic(bwc->m->mono_time) - bwc->cycle.last_sent_timestamp > BWC_SEND_INTERVAL_MS) { |
142 | bwc->packet_loss_counted_cycles = 0; | 142 | bwc->packet_loss_counted_cycles = 0; |
143 | 143 | ||
144 | if (bwc->cycle.lost) { | 144 | if (bwc->cycle.lost) { |
@@ -159,7 +159,7 @@ void send_update(BWController *bwc) | |||
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | bwc->cycle.last_sent_timestamp = current_time_monotonic(); | 162 | bwc->cycle.last_sent_timestamp = current_time_monotonic(bwc->m->mono_time); |
163 | bwc->cycle.lost = 0; | 163 | bwc->cycle.lost = 0; |
164 | bwc->cycle.recv = 0; | 164 | bwc->cycle.recv = 0; |
165 | } | 165 | } |
@@ -170,12 +170,12 @@ static int on_update(BWController *bwc, const struct BWCMessage *msg) | |||
170 | LOGGER_DEBUG(bwc->m->log, "%p Got update from peer", (void *)bwc); | 170 | LOGGER_DEBUG(bwc->m->log, "%p Got update from peer", (void *)bwc); |
171 | 171 | ||
172 | /* Peers sent update too soon */ | 172 | /* Peers sent update too soon */ |
173 | if (bwc->cycle.last_recv_timestamp + BWC_SEND_INTERVAL_MS > current_time_monotonic()) { | 173 | if (bwc->cycle.last_recv_timestamp + BWC_SEND_INTERVAL_MS > current_time_monotonic(bwc->m->mono_time)) { |
174 | LOGGER_INFO(bwc->m->log, "%p Rejecting extra update", (void *)bwc); | 174 | LOGGER_INFO(bwc->m->log, "%p Rejecting extra update", (void *)bwc); |
175 | return -1; | 175 | return -1; |
176 | } | 176 | } |
177 | 177 | ||
178 | bwc->cycle.last_recv_timestamp = current_time_monotonic(); | 178 | bwc->cycle.last_recv_timestamp = current_time_monotonic(bwc->m->mono_time); |
179 | 179 | ||
180 | uint32_t recv = net_ntohl(msg->recv); | 180 | uint32_t recv = net_ntohl(msg->recv); |
181 | uint32_t lost = net_ntohl(msg->lost); | 181 | uint32_t lost = net_ntohl(msg->lost); |