On Fri, Mar 06, 2020 at 05:23:31PM -0600, Eric Blake wrote:
Overall looks good. As you say, we may want to enhance nbdkit with
a way to enforce that a client complete handshake within a given
time limit rather than dragging their feet, but that is separate
from this filter.
I had a look into this and it's harder than it looks.
My attempt sets up a timer (timer_create(2) + timer_settime(2)) in the
connection struct, counting down from (say) 60 seconds but without
sending any signal on expiry (SIGEV_NONE).
Then I modified raw_recv / crypt_recv so that they check if we are
still in the handshake phase, and check the timer for how long is
remaining, and either quit the connection immediately or use poll(2)
to limit the time we wait in recv.
It's all very invasive, complicated and ugly.
Actually while writing the above I can see that using a POSIX timer is
pointless. We might as well simply save gettimeofday(2) when we
create the connection struct. However that doesn't help all the
ugliness in recv.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/