Skip to content

Commit

Permalink
fix: only check the noSendWaiting option; ignore multicast/unicast
Browse files Browse the repository at this point in the history
The current check for multicast and unicast is not correct, and is
also unnecessary; we should only check the noSendWaiting option.
  • Loading branch information
meling committed Mar 26, 2024
1 parent 480ea63 commit f8e8342
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@ func (c *channel) deleteRouter(msgID uint64) {
}

func (c *channel) sendMsg(req request) (err error) {
// unblock the waiting caller unless noSendWaiting is enabled
defer func() {
if req.opts.callType == E_Multicast || req.opts.callType == E_Unicast && !req.opts.noSendWaiting {
// While the default is to block the caller until the message has been sent, we
// can provide the WithNoSendWaiting call option to more quickly unblock the caller.
// Hence, after sending, we unblock the waiting caller unless noSendWaiting is enabled.
// If noSendWaiting is enabled, the calling call type will not block on the response
// channel, and the receiver goroutine below will call routeResponse to delete the router.
if !req.opts.noSendWaiting {
c.routeResponse(req.msg.Metadata.MessageID, response{})
}
}()
Expand Down
3 changes: 1 addition & 2 deletions multicast.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ func (c RawConfiguration) Multicast(ctx context.Context, d QuorumCallData, opts

// nodeStream sends an empty reply on replyChan when the message has been sent
// wait until the message has been sent
for sentMsgs > 0 {
for ; sentMsgs > 0; sentMsgs-- {
<-replyChan
sentMsgs--
}
}

0 comments on commit f8e8342

Please sign in to comment.