Commit 6013394c authored by Steven Allen's avatar Steven Allen

set the session context

fixes https://github.com/ipfs/go-bitswap/issues/131
parent b46b687f
......@@ -115,6 +115,7 @@ func NewSession(ctx context.Context, bs BlockService) *Session {
exch := bs.Exchange()
if sessEx, ok := exch.(exchange.SessionExchange); ok {
return &Session{
sessCtx: ctx,
ses: nil,
sessEx: sessEx,
bs: bs.Blockstore(),
......@@ -122,6 +123,7 @@ func NewSession(ctx context.Context, bs BlockService) *Session {
}
return &Session{
ses: exch,
sessCtx: ctx,
bs: bs.Blockstore(),
}
}
......
......@@ -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
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment