Skip to content

Commit

Permalink
Wait for ENet socket readability rather than just sleeping 10 ms
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed May 15, 2021
1 parent 43eb36e commit 97216e1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ControlStream.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,12 +683,15 @@ static void controlReceiveThreadFunc(void* context) {
}
}
else {
// No events ready - sleep for a short time
// No events ready - wait for readability.
//
// NOTE: This sleep *directly* impacts the lowest possible retransmission
// NOTE: This wait *directly* impacts the lowest possible retransmission
// time for packets after a loss event. If we're busy sleeping here, we can't
// retransmit a dropped packet, so we keep the sleep time to a minimum.
PltSleepMsInterruptible(&controlReceiveThread, 10);
//
// TODO: Dynamically sleep until next RTO rather than waking every 10 ms
enet_uint32 condition = ENET_SOCKET_WAIT_RECEIVE;
enet_socket_wait(client->socket, &condition, 10);
continue;
}
}
Expand Down

0 comments on commit 97216e1

Please sign in to comment.