You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @George-Miao . I would like to work on this RFC if that's fine. Is there any context that I would require for this? Happy to discuss it to avoid going in the wrong direction. I have started reading the source of compio-driver.
Hi @George-Miao . I would like to work on this RFC if that's fine. Is there any context that I would require for this? Happy to discuss it to avoid going in the wrong direction. I have started reading the source of compio-driver.
Sounds good. Just begin with driver, adding getter to Extra like what buffer_id does, then add a field & some helper function to sockets in compio-net, you may want to store the returned socket state before user get a chance to retrieve it. This should be done in two separate PR's.
For compio-net I was thinking along the lines of when the Key::set_result function gets called, it calls Carry::set_result which calls OpCode::set_result with the Extra as the argument. The Extra has to be used there to retrieve information about whether the socket was empty which could be done by adding a field with type Option<bool> to the various receive opcode types and then modifying OpCode::set_result for those types to call Extra::sock_nonempty which sets that field accordingly. We could then also add a sock_nonempty getter on the receive types which would return Some(..) on the IOURING driver and None on other drivers. The same field could then be added to compio_net::Socket and the gettter on Socket could simply then simply return that field which would either be Some(true) or Some(false) accordingly and None on drivers other than IOURING.
Or the better approach to refactor the Extra::sock_nonempty to return an Option<bool> instead of io::Result<bool> in order to avoid the conditional inside of OpCode::set_result to check whether we received the Ok or the Err variant. That allows us to store the output of sock_nonempty directly inside of the OpCode implementing types and it also avoids the heap allocation that would come associated with the Err variant.
Activity
[-]RFC: Supports SOCK_NONEMPTY[/-][+]RFC: Supports socket state on iouring[/+]abh1nav10 commentedon Apr 11, 2026
Hi @George-Miao . I would like to work on this RFC if that's fine. Is there any context that I would require for this? Happy to discuss it to avoid going in the wrong direction. I have started reading the source of
compio-driver.George-Miao commentedon Apr 11, 2026
Sounds good. Just begin with driver, adding getter to Extra like what buffer_id does, then add a field & some helper function to sockets in compio-net, you may want to store the returned socket state before user get a chance to retrieve it. This should be done in two separate PR's.
abh1nav10 commentedon Apr 12, 2026
For
compio-netI was thinking along the lines of when theKey::set_resultfunction gets called, it callsCarry::set_resultwhich callsOpCode::set_resultwith theExtraas the argument. TheExtrahas to be used there to retrieve information about whether the socket was empty which could be done by adding a field with typeOption<bool>to the various receive opcode types and then modifyingOpCode::set_resultfor those types to callExtra::sock_nonemptywhich sets that field accordingly. We could then also add asock_nonemptygetter on the receive types which would return Some(..) on the IOURING driver and None on other drivers. The same field could then be added tocompio_net::Socketand the gettter onSocketcould simply then simply return that field which would either beSome(true)orSome(false)accordingly and None on drivers other than IOURING.Or the better approach to refactor the
Extra::sock_nonemptyto return anOption<bool>instead ofio::Result<bool>in order to avoid the conditional inside ofOpCode::set_resultto check whether we received theOkor theErrvariant. That allows us to store the output ofsock_nonemptydirectly inside of theOpCodeimplementing types and it also avoids the heap allocation that would come associated with theErrvariant.George-Miao commentedon Apr 12, 2026
I like the first approach more, let's do that.