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