Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-core
Commits
980a554a
Commit
980a554a
authored
Feb 17, 2021
by
vyzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make UseTransient context option take a reason argument, for consistency with other options
parent
a21b06e6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
network/context.go
network/context.go
+5
-5
No files found.
network/context.go
View file @
980a554a
...
...
@@ -71,15 +71,15 @@ func WithDialPeerTimeout(ctx context.Context, timeout time.Duration) context.Con
// WithUseTransient constructs a new context with an option that instructs the network
// that it is acceptable to use a transient connection when opening a new stream.
func
WithUseTransient
(
ctx
context
.
Context
)
context
.
Context
{
return
context
.
WithValue
(
ctx
,
useTransient
,
true
)
func
WithUseTransient
(
ctx
context
.
Context
,
reason
string
)
context
.
Context
{
return
context
.
WithValue
(
ctx
,
useTransient
,
reason
)
}
// GetUseTransient returns true if the use transient option is set in the context.
func
GetUseTransient
(
ctx
context
.
Context
)
bool
{
func
GetUseTransient
(
ctx
context
.
Context
)
(
usetransient
bool
,
reason
string
)
{
v
:=
ctx
.
Value
(
useTransient
)
if
v
!=
nil
{
return
true
return
true
,
v
.
(
string
)
}
return
false
return
false
,
""
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment