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. :/

Follow

@isomer Doesn't this just at worst delay your collection of timestamps, as long as you have an uninterrupted stream of packets being sent? (I'm not sure what you want to use this for, and so whether that's no inconvenience, some inconvenience, or an insurmountable problem.)

@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.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.