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
dms3
go-blockservice
Commits
6013394c
Commit
6013394c
authored
May 24, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set the session context
fixes
https://github.com/ipfs/go-bitswap/issues/131
parent
b46b687f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
blockservice.go
blockservice.go
+7
-5
blockservice_test.go
blockservice_test.go
+4
-1
No files found.
blockservice.go
View file @
6013394c
...
...
@@ -115,14 +115,16 @@ func NewSession(ctx context.Context, bs BlockService) *Session {
exch
:=
bs
.
Exchange
()
if
sessEx
,
ok
:=
exch
.
(
exchange
.
SessionExchange
);
ok
{
return
&
Session
{
ses
:
nil
,
sessEx
:
sessEx
,
bs
:
bs
.
Blockstore
(),
sessCtx
:
ctx
,
ses
:
nil
,
sessEx
:
sessEx
,
bs
:
bs
.
Blockstore
(),
}
}
return
&
Session
{
ses
:
exch
,
bs
:
bs
.
Blockstore
(),
ses
:
exch
,
sessCtx
:
ctx
,
bs
:
bs
.
Blockstore
(),
}
}
...
...
blockservice_test.go
View file @
6013394c
...
...
@@ -102,6 +102,9 @@ type fakeSessionExchange struct {
session
exchange
.
Fetcher
}
func
(
fe
*
fakeSessionExchange
)
NewSession
(
context
.
Context
)
exchange
.
Fetcher
{
func
(
fe
*
fakeSessionExchange
)
NewSession
(
ctx
context
.
Context
)
exchange
.
Fetcher
{
if
ctx
==
nil
{
panic
(
"nil context"
)
}
return
fe
.
session
}
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