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

add support for transient connections #175

Merged
merged 6 commits into from
Feb 17, 2021
Merged

add support for transient connections #175

merged 6 commits into from
Feb 17, 2021

Conversation

vyzo
Copy link
Contributor

@vyzo vyzo commented Feb 3, 2021

It adds a transient mark in the metadata and a context option to opt-in for opening streams on transient connections.

Copy link
Contributor

@yusefnapora yusefnapora left a comment

Choose a reason for hiding this comment

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

This looks good to me - nice and backwards compatible.

network/context.go Outdated Show resolved Hide resolved
@aarshkshah1992
Copy link
Contributor

aarshkshah1992 commented Feb 4, 2021

@vyzo So, this is backward compatible because existing peers will not use limited Relays, right ? The limited relay will ofc be a new protocol that existing peers will have no idea about.

Also, note that we will have to change the stream opening code in non-chatty protocols such as DHT & friends to instruct the network to go ahead with opening streams on transient conns.

@vyzo
Copy link
Contributor Author

vyzo commented Feb 4, 2021

yeah, it's backwards compatible.

@vyzo
Copy link
Contributor Author

vyzo commented Feb 4, 2021

The changes in things like the DHT will be in the incoming connection notifee -- there we can check for transient conns and ignore them if we are not prepared to deal with them.

Copy link
Contributor

@aarshkshah1992 aarshkshah1992 left a comment

Choose a reason for hiding this comment

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

some quick changes. Also need to fix the conflicts.

network/conn.go Show resolved Hide resolved
network/network.go Outdated Show resolved Hide resolved
// GetUseTransient returns true if the use transient option is set in the context.
func GetUseTransient(ctx context.Context) bool {
v := ctx.Value(useTransient)
if v != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

return v != nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

double sigh...

@vyzo vyzo merged commit faf23c3 into master Feb 17, 2021
@vyzo vyzo deleted the feat/transient-conns branch February 17, 2021 09:25
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