Commit 3cbcd135 authored by Jonathon Duerig's avatar Jonathon Duerig

Added a failure condition for negative deltas

parent 5fbb1830
......@@ -1200,7 +1200,21 @@ void handle_packet_buffer(struct timeval * deadline, fd_set * write_fds_copy)
}
}
}
delta += packet.delta;
if (packet.delta == 0)
{
++delta;
}
else
{
delta += packet.delta;
}
if (delta <= 0)
{
fprintf(stderr, "Delta is below 0! delta: %d, packet.delta %d"
", write_delta_total: %d\n",
delta, packet.delta, write_delta_total);
clean_exit(1);
}
deadline->tv_usec += delta * 1000;
if (deadline->tv_usec > 1000000)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment