Commit d905de22 authored by Brian Tiger Chow's avatar Brian Tiger Chow

remove prefix logger

parent 6cd6b377
......@@ -173,10 +173,6 @@ func (bs *bitswap) sendWantlistMsgToPeers(ctx context.Context, m bsmsg.BitSwapMe
panic("Cant send wantlist to nil peerchan")
}
log := log.Prefix("bitswap(%s).sendWantlistMsgToPeers(%d)", bs.self, len(m.Wantlist()))
log.Debugf("begin")
defer log.Debugf("end")
set := pset.New()
wg := sync.WaitGroup{}
for peerToQuery := range peers {
......@@ -216,10 +212,6 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
return
}
log := log.Prefix("bitswap(%s).sendWantlistToProviders ", bs.self)
log.Debugf("begin")
defer log.Debugf("end")
ctx, cancel := context.WithCancel(ctx)
defer cancel()
......@@ -233,9 +225,6 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
go func(k u.Key) {
defer wg.Done()
log := log.Prefix("(entry: %s) ", k)
log.Debug("asking dht for providers")
child, _ := context.WithTimeout(ctx, providerRequestTimeout)
providers := bs.network.FindProvidersAsync(child, k, maxProvidersPerRequest)
for prov := range providers {
......@@ -257,7 +246,6 @@ func (bs *bitswap) sendWantlistToProviders(ctx context.Context) {
}
func (bs *bitswap) taskWorker(ctx context.Context) {
log := log.Prefix("bitswap(%s).taskWorker", bs.self)
for {
select {
case <-ctx.Done():
......
......@@ -163,10 +163,6 @@ func (e *Engine) MessageReceived(p peer.ID, m bsmsg.BitSwapMessage) error {
e.lock.Lock()
defer e.lock.Unlock()
log := log.Prefix("bitswap.Engine.MessageReceived(%s)", p)
log.Debugf("enter. %d entries %d blocks", len(m.Wantlist()), len(m.Blocks()))
defer log.Debugf("exit")
if len(m.Wantlist()) == 0 && len(m.Blocks()) == 0 {
log.Info("superfluous message")
}
......
......@@ -39,28 +39,23 @@ func (bsnet *impl) SendMessage(
p peer.ID,
outgoing bsmsg.BitSwapMessage) error {
log := log.Prefix("bitswap net SendMessage to %s", p)
// ensure we're connected
//TODO(jbenet) move this into host.NewStream?
if err := bsnet.host.Connect(ctx, peer.PeerInfo{ID: p}); err != nil {
return err
}
log.Debug("opening stream")
s, err := bsnet.host.NewStream(ProtocolBitswap, p)
if err != nil {
return err
}
defer s.Close()
log.Debug("sending")
if err := outgoing.ToNet(s); err != nil {
log.Errorf("error: %s", err)
return err
}
log.Debug("sent")
return err
}
......@@ -69,35 +64,29 @@ func (bsnet *impl) SendRequest(
p peer.ID,
outgoing bsmsg.BitSwapMessage) (bsmsg.BitSwapMessage, error) {
log := log.Prefix("bitswap net SendRequest to %s", p)
// ensure we're connected
//TODO(jbenet) move this into host.NewStream?
if err := bsnet.host.Connect(ctx, peer.PeerInfo{ID: p}); err != nil {
return nil, err
}
log.Debug("opening stream")
s, err := bsnet.host.NewStream(ProtocolBitswap, p)
if err != nil {
return nil, err
}
defer s.Close()
log.Debug("sending")
if err := outgoing.ToNet(s); err != nil {
log.Errorf("error: %s", err)
return nil, err
}
log.Debug("sent, now receiveing")
incoming, err := bsmsg.FromNet(s)
if err != nil {
log.Errorf("error: %s", err)
return incoming, err
}
log.Debug("received")
return incoming, nil
}
......
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