mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/swarm/swarm-smoke-pss: add msg timeout via flag
This commit is contained in:
parent
0d8c530333
commit
709d49218a
2 changed files with 18 additions and 11 deletions
|
|
@ -43,6 +43,7 @@ var (
|
|||
wsPort int
|
||||
verbosity int
|
||||
timeout int
|
||||
pssMessageTimeout int
|
||||
pssMessageCount int
|
||||
pssMessageSize int
|
||||
)
|
||||
|
|
@ -84,6 +85,12 @@ func main() {
|
|||
Usage: "timeout in seconds after which kill the process",
|
||||
Destination: &timeout,
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "msgtimeout",
|
||||
Value: 1,
|
||||
Usage: "timeout in seconds until a message is received",
|
||||
Destination: &pssMessageTimeout,
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "msgcount",
|
||||
Value: 10,
|
||||
|
|
@ -128,7 +135,7 @@ func main() {
|
|||
{
|
||||
Name: "all",
|
||||
Usage: "send and receive raw, sym and asym messages across randome nodes",
|
||||
Action: wrapCliCommand("raw", pssAllCheck),
|
||||
Action: wrapCliCommand("all", pssAllCheck),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -303,8 +303,8 @@ func (s *pssSession) waitForMsg() error {
|
|||
return fmt.Errorf("message mismatch. expected: %s got: %s", resJob.msg, res.Msg)
|
||||
}
|
||||
log.Debug("got msg", "job", hexutil.Encode([]byte(resIdx)))
|
||||
case <-time.After(1 * time.Second):
|
||||
return errors.New("msg timeout after 1 sec")
|
||||
case <-time.After(time.Duration(pssMessageTimeout) * time.Second):
|
||||
return fmt.Errorf("message timeout after %d sec", pssMessageTimeout)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue