Skip to content

Conversation

@drexin
Copy link
Member

@drexin drexin commented Aug 30, 2019

…tion abortion #13

Modifications:

When connections failed we could end up with .initiated handshakes that did not have a channel assigned, which in term caused an assertion to fail when that handshake was being replaced by another one. This PR changes the connection handling by adding a connect timeout, causing the channel to be closed if it does not establish a connection within the timeout and then remove the handshake from the _handshakes dict.

Result:

}

/// Time after which a connection attempt will fail if no connection could be established
public var connectTimeout: TimeAmount = .milliseconds(500)
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

So this is enough, at least right now?

Seems so but wanted to make sure before merging

return context.awaitResult(of: outboundChanElf, timeout: .milliseconds(500)) { result in
// the timeout is being handled by the `connectTimeout` socket option
// in NIO, so it is safe to use an infinite timeout here
return context.awaitResult(of: outboundChanElf, timeout: .effectivelyInfinite) { result in
Copy link
Member

Choose a reason for hiding this comment

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

👍

@drexin
Copy link
Member Author

drexin commented Aug 30, 2019

@ktoso Yeah, I think that should be good for now.

@ktoso
Copy link
Member

ktoso commented Aug 30, 2019

Roger that 🖖

@ktoso ktoso merged commit e5e126b into master Aug 30, 2019
@ktoso ktoso deleted the wip-13 branch August 30, 2019 05:01
ktoso pushed a commit that referenced this pull request Aug 31, 2019
#71)

* Add connectTimeout to outgoing connections and fix handling of connection abortion #13

* Fix reconnection issue
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.

FAILED: ClusterAssociationTests.test_association_shouldEstablishSingleAssociationForConcurrentlyInitiatedHandshakes_incoming_outgoing

3 participants