mirror of
https://github.com/wwhai/mqtt-benchmark.git
synced 2025-10-04 15:22:43 +08:00
Fixed formatting and linter errors
This commit is contained in:
27
client.go
27
client.go
@@ -19,7 +19,7 @@ type Client struct {
|
||||
BrokerUser string
|
||||
BrokerPass string
|
||||
MsgTopic string
|
||||
MsgPayload string
|
||||
MsgPayload string
|
||||
MsgSize int
|
||||
MsgCount int
|
||||
MsgQoS byte
|
||||
@@ -57,7 +57,7 @@ func (c *Client) Run(res chan *RunResults) {
|
||||
}
|
||||
case <-donePub:
|
||||
// calculate results
|
||||
duration := time.Now().Sub(started)
|
||||
duration := time.Since(started)
|
||||
runResults.MsgTimeMin = stats.StatsMin(times)
|
||||
runResults.MsgTimeMax = stats.StatsMax(times)
|
||||
runResults.MsgTimeMean = stats.StatsMean(times)
|
||||
@@ -77,22 +77,21 @@ func (c *Client) Run(res chan *RunResults) {
|
||||
|
||||
func (c *Client) genMessages(ch chan *Message, done chan bool) {
|
||||
var payload interface{}
|
||||
// set payload if specified
|
||||
if c.MsgPayload != "" {
|
||||
payload = c.MsgPayload
|
||||
} else {
|
||||
payload = make([]byte, c.MsgSize)
|
||||
}
|
||||
// set payload if specified
|
||||
if c.MsgPayload != "" {
|
||||
payload = c.MsgPayload
|
||||
} else {
|
||||
payload = make([]byte, c.MsgSize)
|
||||
}
|
||||
|
||||
ch <- &Message{
|
||||
Topic: c.MsgTopic,
|
||||
QoS: c.MsgQoS,
|
||||
Payload: payload,
|
||||
}
|
||||
ch <- &Message{
|
||||
Topic: c.MsgTopic,
|
||||
QoS: c.MsgQoS,
|
||||
Payload: payload,
|
||||
}
|
||||
|
||||
done <- true
|
||||
// log.Printf("CLIENT %v is done generating messages\n", c.ID)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) pubMessages(in, out chan *Message, doneGen, donePub chan bool) {
|
||||
|
Reference in New Issue
Block a user