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,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(),
}
}
......
......@@ -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