mirror of
https://github.com/go-mqtt/mqtt.git
synced 2025-08-07 11:42:52 +03:00
Nonfunctional code reorder.
This commit is contained in:
@@ -11,19 +11,6 @@ import (
|
||||
"github.com/pascaldekloe/mqtt"
|
||||
)
|
||||
|
||||
// NewPublishStub returns a new stub for mqtt.Client Publish with a fixed return
|
||||
// value.
|
||||
func NewPublishStub(returnFix error) func(quit <-chan struct{}, message []byte, topic string) error {
|
||||
return func(quit <-chan struct{}, message []byte, topic string) error {
|
||||
select {
|
||||
case <-quit:
|
||||
return mqtt.ErrCanceled
|
||||
default:
|
||||
return returnFix
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer defines a message exchange.
|
||||
type Transfer struct {
|
||||
Message []byte // payload
|
||||
@@ -95,6 +82,19 @@ func NewPublishMock(t testing.TB, want ...Transfer) func(quit <-chan struct{}, m
|
||||
}
|
||||
}
|
||||
|
||||
// NewPublishStub returns a new stub for mqtt.Client Publish with a fixed return
|
||||
// value.
|
||||
func NewPublishStub(returnFix error) func(quit <-chan struct{}, message []byte, topic string) error {
|
||||
return func(quit <-chan struct{}, message []byte, topic string) error {
|
||||
select {
|
||||
case <-quit:
|
||||
return mqtt.ErrCanceled
|
||||
default:
|
||||
return returnFix
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AckBlock prevents ack <-chan error submission.
|
||||
type AckBlock struct {
|
||||
Delay time.Duration // zero defaults to indefinite
|
||||
|
Reference in New Issue
Block a user