Commit a1530f84 authored by zramsay's avatar zramsay

apply the megacheck tool to improve code quality

License: MIT
Signed-off-by: default avatarZach Ramsay <zach.ramsay@gmail.com>
parent 940ef108
......@@ -37,9 +37,9 @@ const (
// TODO: if a 'non-nice' strategy is implemented, consider increasing this value
maxProvidersPerRequest = 3
providerRequestTimeout = time.Second * 10
hasBlockTimeout = time.Second * 15
provideTimeout = time.Second * 15
sizeBatchRequestChan = 32
// hasBlockTimeout = time.Second * 15
provideTimeout = time.Second * 15
sizeBatchRequestChan = 32
// kMaxPriority is the max priority as defined by the bitswap protocol
kMaxPriority = math.MaxInt32
)
......
......@@ -199,7 +199,7 @@ func PerformDistributionTest(t *testing.T, numInstances, numBlocks int) {
if err != nil {
errs <- err
}
for _ = range outch {
for range outch {
}
}(inst)
}
......@@ -226,16 +226,6 @@ func PerformDistributionTest(t *testing.T, numInstances, numBlocks int) {
}
}
func getOrFail(bitswap Instance, b blocks.Block, t *testing.T, wg *sync.WaitGroup) {
if _, err := bitswap.Blockstore().Get(b.Cid()); err != nil {
_, err := bitswap.Exchange.GetBlock(context.Background(), b.Cid())
if err != nil {
t.Fatal(err)
}
}
wg.Done()
}
// TODO simplify this test. get to the _essence_!
func TestSendToWantingPeer(t *testing.T) {
if testing.Short() {
......
......@@ -220,19 +220,13 @@ func (m *impl) ToProtoV1() *pb.Message {
func (m *impl) ToNetV0(w io.Writer) error {
pbw := ggio.NewDelimitedWriter(w)
if err := pbw.WriteMsg(m.ToProtoV0()); err != nil {
return err
}
return nil
return pbw.WriteMsg(m.ToProtoV0())
}
func (m *impl) ToNetV1(w io.Writer) error {
pbw := ggio.NewDelimitedWriter(w)
if err := pbw.WriteMsg(m.ToProtoV1()); err != nil {
return err
}
return nil
return pbw.WriteMsg(m.ToProtoV1())
}
func (m *impl) Loggable() map[string]interface{} {
......
......@@ -88,8 +88,8 @@ func (i *Instance) SetBlockstoreLatency(t time.Duration) time.Duration {
// just a much better idea.
func Session(ctx context.Context, net tn.Network, p testutil.Identity) Instance {
bsdelay := delay.Fixed(0)
const bloomSize = 512
const writeCacheElems = 100
// const bloomSize = 512
// const writeCacheElems = 100
adapter := net.Adapter(p)
dstore := ds_sync.MutexWrap(datastore2.WithDelay(ds.NewMapDatastore(), bsdelay))
......
......@@ -55,7 +55,7 @@ func NewWantManager(ctx context.Context, network bsnet.BitSwapNetwork) *WantMana
}
}
type msgPair struct {
/*type msgPair struct {
to peer.ID
msg bsmsg.BitSwapMessage
}
......@@ -63,7 +63,7 @@ type msgPair struct {
type cancellation struct {
who peer.ID
blk *cid.Cid
}
}*/
type msgQueue struct {
p peer.ID
......
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