-
Notifications
You must be signed in to change notification settings - Fork 90
Add MPTCP support #898
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
base: dev
Are you sure you want to change the base?
Add MPTCP support #898
Changes from all commits
6b6241f
4c7e3df
810b98d
d5cc467
890da60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,6 +94,13 @@ type ChannelOptions struct { | |
| // This is an unstable API - breaking changes are likely. | ||
| RelayTimerVerification bool | ||
|
|
||
| // EnableMPTCP enables MPTCP for TCP network connection to increase reliability. | ||
| // It requires underlying operating system support MPTCP. | ||
| // If EnableMPTCP is false or no MPTCP support, the connection will use normal TCP. | ||
| // It's set to false by default. | ||
| // If a Dialer is passed as option, this value will be ignored. | ||
| EnableMPTCP bool | ||
|
|
||
| // The reporter to use for reporting stats for this channel. | ||
| StatsReporter StatsReporter | ||
|
|
||
|
|
@@ -184,6 +191,7 @@ type Channel struct { | |
| relayMaxConnTimeout time.Duration | ||
| relayMaxTombs uint64 | ||
| relayTimerVerify bool | ||
| enableMPTCP bool | ||
| internalHandlers *handlerMap | ||
| handler Handler | ||
| onPeerStatusChanged func(*Peer) | ||
|
|
@@ -275,8 +283,12 @@ func NewChannel(serviceName string, opts *ChannelOptions) (*Channel, error) { | |
| return nil, err | ||
| } | ||
|
|
||
| // Default to dialContext if dialer is not passed in as an option | ||
| // Default to dialContext or dialMPTCPContex | ||
| // if dialer is not passed in as an option | ||
| dialCtx := dialContext | ||
| if opts.EnableMPTCP { | ||
| dialCtx = dialMPTCPContext | ||
| } | ||
| if opts.Dialer != nil { | ||
| dialCtx = func(ctx context.Context, hostPort string) (net.Conn, error) { | ||
| return opts.Dialer(ctx, "tcp", hostPort) | ||
|
Comment on lines
292
to
294
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens if I set both
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we added a comment regarding this |
||
|
|
@@ -306,6 +318,7 @@ func NewChannel(serviceName string, opts *ChannelOptions) (*Channel, error) { | |
| relayMaxConnTimeout: opts.RelayMaxConnectionTimeout, | ||
| relayMaxTombs: opts.RelayMaxTombs, | ||
| relayTimerVerify: opts.RelayTimerVerification, | ||
| enableMPTCP: opts.EnableMPTCP, | ||
| dialer: dialCtx, | ||
| connContext: opts.ConnContext, | ||
| closed: make(chan struct{}), | ||
|
|
@@ -402,7 +415,9 @@ func (ch *Channel) ListenAndServe(hostPort string) error { | |
| return errAlreadyListening | ||
| } | ||
|
|
||
| l, err := net.Listen("tcp", hostPort) | ||
| lc := net.ListenConfig{} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Yarpc does not hit this method for tchannel servers, it creates a listener of its own and passes into
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea I'm aware of that. But for the sake of completeness of this feature, I think we need to do this change.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On my understanding, if a
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we actually use |
||
| lc.SetMultipathTCP(ch.enableMPTCP) | ||
| l, err := lc.Listen(context.Background(), "tcp", hostPort) | ||
| if err != nil { | ||
| mutable.RUnlock() | ||
| return err | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.