Skip to content

RFC: Supports socket state on iouring #855

Description

@George-Miao

Link: https://github.com/axboe/liburing/wiki/io_uring-and-networking-in-2023#socket-state

Should be a relatively easy implementation, just add a getter to extra and to socket should be good enough.

Activity

  1. changed the title [-]RFC: Supports SOCK_NONEMPTY[/-] [+]RFC: Supports socket state on iouring[/+] on Apr 10, 2026
  2. abh1nav10 commented on Apr 11, 2026

    @abh1nav10
    Contributor

    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.

  3. George-Miao commented on Apr 11, 2026

    @George-Miao
    MemberAuthor

    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.

  4. abh1nav10 commented on Apr 12, 2026

    @abh1nav10
    Contributor

    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.

  5. George-Miao commented on Apr 12, 2026

    @George-Miao
    MemberAuthor

    I like the first approach more, let's do that.

  6. added this to the v0.19 milestone on Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions