Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: Handle sending/receiving in separate goroutines #94

Merged
merged 1 commit into from
Oct 30, 2021

Commits on Oct 14, 2021

  1. client: Handle sending/receiving in separate goroutines

    Changes the TTRPC client logic so that sending and receiving with the
    server are in completely independent goroutines, with shared state
    guarded by a mutex. Previously, sending/receiving were tied together by
    reliance on a coordinator goroutine. This led to issues where if the
    server was not reading from the connection, the client could get stuck
    sending a request, causing the client to not read responses from the
    server. See [1] for more details.
    
    The new design sets up separate sending/receiving goroutines. These
    share state in the form of the set of active calls that have been made
    to the server. This state is encapsulated in the callMap type and access
    is guarded by a mutex.
    
    The main event loop in `run` previously handled a lot of state
    management for the client. Now that most state is tracked by the
    callMap, it mostly exists to notice when the client is closed and take
    appropriate action to clean up.
    
    Also did some minor code cleanup. For instance, the code was previously
    written to support multiple receiver goroutines, though this was not
    actually used. I've removed this for now, since the code is simpler this
    way, and it's easy to add back if we actually need it in the future.
    
    [1] containerd#72
    
    Signed-off-by: Kevin Parsons <[email protected]>
    kevpar committed Oct 14, 2021
    Configuration menu
    Copy the full SHA
    4f0aeb5 View commit details
    Browse the repository at this point in the history