Skip to content

Commit e2d3b03

Browse files
committed
Just dont shut down the queues on Message sender errors
1 parent 5fc1026 commit e2d3b03

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

bitswap/client/internal/messagequeue/messagequeue.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ func (mq *MessageQueue) sendMessage() {
562562
// If we fail to initialize the sender, the networking layer will
563563
// emit a Disconnect event and the MessageQueue will get cleaned up
564564
log.Infof("Could not open message sender to peer %s: %s", mq.p, err)
565-
mq.Shutdown()
565+
// do not shudown the queue here, wait for Disconnect to arrive.
566566
return
567567
}
568568

@@ -593,7 +593,7 @@ func (mq *MessageQueue) sendMessage() {
593593
// If the message couldn't be sent, the networking layer will
594594
// emit a Disconnect event and the MessageQueue will get cleaned up
595595
log.Infof("Could not send message to peer %s: %s", mq.p, err)
596-
mq.Shutdown()
596+
// do not shudown the queue here, wait for Disconnect to arrive.
597597
return
598598
}
599599

bitswap/network/bsnet/ipfs_impl.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ func (s *streamMessageSender) send(ctx context.Context, msg bsmsg.BitSwapMessage
244244
stream, err := s.Connect(ctx)
245245
if err != nil {
246246
log.Infof("failed to open stream to %s: %s", s.to, err)
247+
s.bsnet.connectEvtMgr.MarkUnresponsive(s.to)
247248
return err
248249
}
249250

@@ -253,6 +254,7 @@ func (s *streamMessageSender) send(ctx context.Context, msg bsmsg.BitSwapMessage
253254
timeout := s.opts.SendTimeout - time.Since(start)
254255
if err = s.bsnet.msgToStream(ctx, stream, msg, timeout); err != nil {
255256
log.Infof("failed to send message to %s: %s", s.to, err)
257+
s.bsnet.connectEvtMgr.MarkUnresponsive(s.to)
256258
return err
257259
}
258260

0 commit comments

Comments
 (0)