revid: multiSender active=>isActive

This commit is contained in:
Saxon 2019-03-14 09:09:57 +10:30
parent caff9eddaa
commit 4881e179cc
1 changed files with 6 additions and 6 deletions

View File

@ -55,9 +55,9 @@ type Sender interface {
// multiSender allows for the sending through multi loadSenders using a single // multiSender allows for the sending through multi loadSenders using a single
// call to multiSender.Write. // call to multiSender.Write.
type multiSender struct { type multiSender struct {
active func() bool isActive func() bool
senders []loadSender senders []loadSender
retry bool retry bool
} }
// newMultiSender returns a pointer to a new multiSender. active is a function // newMultiSender returns a pointer to a new multiSender. active is a function
@ -68,8 +68,8 @@ func newMultiSender(senders []loadSender, active func() bool) *multiSender {
panic("multi sender requires that active func is provided") panic("multi sender requires that active func is provided")
} }
s := &multiSender{ s := &multiSender{
senders: senders, senders: senders,
active: active, isActive: active,
} }
return s return s
} }
@ -80,7 +80,7 @@ func newMultiSender(senders []loadSender, active func() bool) *multiSender {
func (s *multiSender) Write(d []byte) (int, error) { func (s *multiSender) Write(d []byte) (int, error) {
for _, sender := range s.senders { for _, sender := range s.senders {
sender.load(d) sender.load(d)
for s.active() { for s.isActive() {
err := sender.send() err := sender.send()
if err != nil { if err != nil {
sender.handleSendFail(err) sender.handleSendFail(err)