Skip to content
Snippets Groups Projects
  • Nick Vikeras's avatar
    Plumb RPC listener up to caller (#5038) · c72f9ab5
    Nick Vikeras authored
    
    # Description
    
    This PR allows the RPC server's socket address to be returned when
    initializing the server. This allows the library consumer to easily
    programmatically determine which port the RPC server is listening on. My
    use case for this is automated testing. I'd like to be able to simply
    specify that the server bind to port '0' and then test against whatever
    port the OS assigns dynamically. I will have many RPC servers running in
    parallel across many tests within a single process, and I don't want to
    have to deal with port conflicts.
    
    ## Integration
    
    Integration is straightforward. My main concern is that I am making
    non-backwards-compatible changes to public library functions. Let me
    know if I should leave backwards-compatible wrappers in place for
    any/all of the public functions that were modified.
    
    ## Review Notes
    The rationale for making the new listen_addresses field on the
    RpcHandlers struct a ```[MultiAddr]``` rather than ```SocketAddr``` is
    because I wanted it to be transport-agnostic as well as capable of
    supporting multiple listening addresses in case that is ever required by
    the RPC server in the future.
    
    # Checklist
    
    * [x] My PR includes a detailed description as outlined in the
    "Description" and its two subsections above.
    * [ ] My PR follows the [labeling requirements](CONTRIBUTING.md#Process)
    of this project (at minimum one label for `T`
      required)
    * External contributors: ask maintainers to put the right label on your
    PR.
    * [x] I have made corresponding changes to the documentation (if
    applicable)
    * [ ] I have added tests that prove my fix is effective or that my
    feature works (if applicable)
    
    1. I didn't understand what the 'T' label meant. Am I supposed to open a
    github Issue for my PR?
    2. I didn't see an easy way to add tests since the functions I am
    modifying are not directly called by any tests.
    
    ---------
    
    Co-authored-by: default avatarNiklas Adolfsson <niklasadolfsson1@gmail.com>
    Unverified
    c72f9ab5
Code owners
Assign users and groups as approvers for specific file changes. Learn more.