Derive Listener Transport from Type of Listener Being Created - #139
Open
themooer1 wants to merge 1 commit into
Open
Derive Listener Transport from Type of Listener Being Created#139themooer1 wants to merge 1 commit into
themooer1 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes the
newmethods onTcpListenerConnection,TlsListenerConnection, andWebSocketListenerConnectionso they tag theirlocal_addrSipAddrwith the correctTransporttype e.g.TlsListenerConnectionusesTransport::Tls. This makes it so those listeners generate the correctContact:headers instead of, e.g. aTlsListenerConnection'slocal_addrcausing a plainsip:...@192.168.1.10:<udp_port>;transport=udpContact:header to be generated.Previously, for everything but
UdpConnection,local_addrwas set to aSipAddrwhich the user passed in, but this didn't make sense becauseSipAddris just aSocketAddr+ aTransporttype. It wouldn't make sense to pass in aTransporttype at odds with the type of listener being constructed, so callers of thenewmethod always just passed inNonefor the transport and that's how it stayed causing theContact:header builder to fall back to thedefault_contact_uriwhich generated an invalidContact:header if the default listener didn't match the type of connection being handled. Since it never makes sense to pass in aSipAddrwith a transport different from the transport used by<whatever>ListenerConnection, I made all the constructors do whatUdpConnection::create_connectiondoes and just accept aSocketAddr, which is the only data the constructor really needs to know. Inside the constructor,local_addris constructed by wrapping theSocketAddrin aSipAddrwith the correctTransport.