Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

make the accept timeout configurable, stop using transport.AcceptTimeout #98

Merged
merged 1 commit into from
Dec 21, 2021

Conversation

marten-seemann
Copy link
Contributor

This is the analogous change to libp2p/go-libp2p-swarm#302. Motivation: stop relying on global variables (and make dial and accept timeouts consistent).

The nicer way to configure this would be by having an option. Unfortunately, that's not possible as we don't have a constructor here.
We could refactor the code by introducing an Upgrader interface, and then unexporting the Upgrader here, while at the same time introducing a constructor.

Copy link
Contributor

@vyzo vyzo left a comment

Choose a reason for hiding this comment

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

1 hour timeout!!!!!

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.

Hm.... This works, but how about a global libp2p "config" that we plug into the dependency injection system?

  1. The config would be something like: struct { TimeoutA time.Duration, Libp2pFeatureB bool, Other map[interface{}]interface{} }.
  2. Config values would be set with a functional option in libp2p.
  3. We'd feed the config to any transport constructors that request it.

Note: for this case, this PR is probably fine. But we do need some way to pass options down.

@marten-seemann marten-seemann merged commit 17ff3c0 into master Dec 21, 2021
@marten-seemann marten-seemann deleted the configurable-accept-timeout branch December 21, 2021 08:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants