diff --git a/.travis.yml b/.travis.yml index 4cfe98c..5163d69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,6 @@ env: global: - GOTFLAGS="-race" matrix: - - BUILD_DEPTYPE=gx - BUILD_DEPTYPE=gomod @@ -24,7 +23,6 @@ script: cache: directories: - - $GOPATH/src/gx - $GOPATH/pkg/mod - $HOME/.cache/go-build diff --git a/blockservice.go b/blockservice.go index 0a442c8..8455065 100644 --- a/blockservice.go +++ b/blockservice.go @@ -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(), } } diff --git a/blockservice_test.go b/blockservice_test.go index 4f093d7..a94b672 100644 --- a/blockservice_test.go +++ b/blockservice_test.go @@ -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 } diff --git a/package.json b/package.json deleted file mode 100644 index 6d3a9b9..0000000 --- a/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "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" -} - diff --git a/test/mock.go b/test/mock.go index 9638f3c..a6eba69 100644 --- a/test/mock.go +++ b/test/mock.go @@ -3,7 +3,7 @@ package bstest import ( . "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" delay "github.com/ipfs/go-ipfs-delay" mockrouting "github.com/ipfs/go-ipfs-routing/mock" @@ -12,7 +12,7 @@ import ( // Mocks returns |n| connected mock Blockservices func Mocks(n int) []BlockService { net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(0)) - sg := bitswap.NewTestSessionGenerator(net) + sg := testinstance.NewTestInstanceGenerator(net) instances := sg.Instances(n)