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:
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
......
......@@ -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
}
{
"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
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)
......
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