Skip to content

Conversation

raulk
Copy link
Member

@raulk raulk commented Nov 1, 2019

Both initiator and responder now time out if reads and/or writes are blocked for 30 seconds (default negotiation timeout).

Introduces two tests to validate the new behaviour.

Fixes #47.
Addresses filecoin-project/lotus#518.

Both initiator and responder now time out if reads
and/or writes are blocked for 30 seconds (default
negotiation timeout).

Introduces two tests to validate the new behaviour.

Fixes #47.
@raulk
Copy link
Member Author

raulk commented Nov 1, 2019

This fails CI because of libp2p/go-libp2p#736.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: IMO, the real issue is libp2p/go-libp2p#738.

(although canceling here as well is probably a good idea anyways)

}
if err2 != nil {
return err2
if clearFn, err := setDeadline(rwc); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, many connections implement net.Conn (and SetDeadline) but don't actually implement it (and instead return an error). This is why we do things like https://github.com/libp2p/go-libp2p-transport-upgrader/blob/0d4065ec7151149beef41f3a8b1fbf6978ed12dc/upgrader.go#L111-L132.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: we could detect and handle os.ErrNoDeadline.

"time"
)

// NegotiationTimeout is the maximum time a protocol negotiation atempt is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/atempt/attempt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

multistream-select v1 does not handle timeouts
4 participants