Unverified Commit 87a79d55 authored by Hector Sanjuan's avatar Hector Sanjuan Committed by GitHub

Merge pull request #28 from ipfs/fix/bs-131

set the session context
parents 2c867f6b fa646131
...@@ -10,7 +10,6 @@ env: ...@@ -10,7 +10,6 @@ env:
global: global:
- GOTFLAGS="-race" - GOTFLAGS="-race"
matrix: matrix:
- BUILD_DEPTYPE=gx
- BUILD_DEPTYPE=gomod - BUILD_DEPTYPE=gomod
...@@ -24,7 +23,6 @@ script: ...@@ -24,7 +23,6 @@ script:
cache: cache:
directories: directories:
- $GOPATH/src/gx
- $GOPATH/pkg/mod - $GOPATH/pkg/mod
- $HOME/.cache/go-build - $HOME/.cache/go-build
......
...@@ -115,6 +115,7 @@ func NewSession(ctx context.Context, bs BlockService) *Session { ...@@ -115,6 +115,7 @@ func NewSession(ctx context.Context, bs BlockService) *Session {
exch := bs.Exchange() exch := bs.Exchange()
if sessEx, ok := exch.(exchange.SessionExchange); ok { if sessEx, ok := exch.(exchange.SessionExchange); ok {
return &Session{ return &Session{
sessCtx: ctx,
ses: nil, ses: nil,
sessEx: sessEx, sessEx: sessEx,
bs: bs.Blockstore(), bs: bs.Blockstore(),
...@@ -122,6 +123,7 @@ func NewSession(ctx context.Context, bs BlockService) *Session { ...@@ -122,6 +123,7 @@ func NewSession(ctx context.Context, bs BlockService) *Session {
} }
return &Session{ return &Session{
ses: exch, ses: exch,
sessCtx: ctx,
bs: bs.Blockstore(), bs: bs.Blockstore(),
} }
} }
......
...@@ -102,6 +102,9 @@ type fakeSessionExchange struct { ...@@ -102,6 +102,9 @@ type fakeSessionExchange struct {
session exchange.Fetcher 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 return fe.session
} }
{
"author": "why",
"bugs": {
"url": "https://github.com/ipfs/go-blockservice"
},
"gx": {
"dvcsimport": "github.com/ipfs/go-blockservice"
},
"gxDependencies": [
{
"author": "why",
"hash": "QmVNRbcH1kKEQUVhCsH75kTGUVFMw2b7zEWyFKyfCwmJjo",
"name": "go-bitswap",
"version": "1.1.31"
},
{
"author": "hsanjuan",
"hash": "Qmb9fkAWgcyVRnFdXGqA6jcWGFj6q35oJjwRAYRhfEboGS",
"name": "go-ipfs-exchange-offline",
"version": "0.1.7"
},
{
"author": "jbenet",
"hash": "QmUadX5EcvrBmxAV9sE7wUWtWSqxns5K84qKJBixmcT1w9",
"name": "go-datastore",
"version": "3.6.1"
},
{
"author": "hsanjuan",
"hash": "QmXjKkjMDTtXAiLBwstVexofB8LeruZmE2eBd85GwGFFLA",
"name": "go-ipfs-blockstore",
"version": "0.1.8"
},
{
"author": "stebalien",
"hash": "QmYYLnAzR28nAQ4U5MFniLprnktu6eTFKibeNt96V21EZK",
"name": "go-block-format",
"version": "0.2.2"
},
{
"author": "why",
"hash": "QmcVd2ApQdbfaYPKhCjj4WoQuxk4CMxPqmNpijKmFLh6qa",
"name": "go-verifcid",
"version": "0.1.2"
}
],
"gxVersion": "0.12.1",
"language": "go",
"license": "",
"name": "go-blockservice",
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
"version": "1.1.31"
}
...@@ -3,7 +3,7 @@ package bstest ...@@ -3,7 +3,7 @@ package bstest
import ( import (
. "github.com/ipfs/go-blockservice" . "github.com/ipfs/go-blockservice"
bitswap "github.com/ipfs/go-bitswap" testinstance "github.com/ipfs/go-bitswap/testinstance"
tn "github.com/ipfs/go-bitswap/testnet" tn "github.com/ipfs/go-bitswap/testnet"
delay "github.com/ipfs/go-ipfs-delay" delay "github.com/ipfs/go-ipfs-delay"
mockrouting "github.com/ipfs/go-ipfs-routing/mock" mockrouting "github.com/ipfs/go-ipfs-routing/mock"
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
// Mocks returns |n| connected mock Blockservices // Mocks returns |n| connected mock Blockservices
func Mocks(n int) []BlockService { func Mocks(n int) []BlockService {
net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(0)) net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(0))
sg := bitswap.NewTestSessionGenerator(net) sg := testinstance.NewTestInstanceGenerator(net)
instances := sg.Instances(n) instances := sg.Instances(n)
......
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