I am trying to implement Rust std for UEFI as a part of my GSoC 2022 project. While trying to implement networking using the EFI_TCP6_PROTOCOL, I am unsure how to proceed. The Rust network operations are synchronous. However, the UEFI side is non-blocking.
So how can I convert a non-blocking UEFI operation to a blocking one? I think it should be possible by using the ListenToken->CompletionToken->Event. However, since this event should be of the EVT_NOTIFY_SIGNAL, it's not possible to call EFI_BOOT_SERVICES.WaitForEvent() on this event. So what am I missing here?
The specific function I am trying to implement is the TcpListener::accept() function. I know this can be non-blocking if the set_nonblocking() option is used, but the default seems to be the blocking. I will also need to make the transmit and receive stuff blocking.