Linux has a way of receiving hardware timestamps for when a packet was transmitted. Neat.
This is done by the timestamp message turning up in the error queue.
Linux tells you there is error data available by signalling EPOLLERR.
But it doesn't appear that tokio has any way to wait for EPOLLERR. What everyone seems to be doing is waiting for EPOLLOUT instead in the assumption that if the packet was sent then there will be space for a new out packet. But this seems very unreliable. :/
@robryk I think what's happening at the moment is I get woken up saying I can send another packet. But the transmit timestamp isn't available yet so I end up EAGAIN. So I go back to sleep. Then I wake up again because the transmit timestamp is available.
It seems pretty inefficient. In my test case there isn't a stream of packets going in and out. I suspect if I'm busy then the extra wake up will be merged with some other useful event and I'll be fine.