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
|
|
@ -37,14 +37,15 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
allhosts string
|
allhosts string
|
||||||
hosts []string
|
hosts []string
|
||||||
inputSeed int
|
inputSeed int
|
||||||
wsPort int
|
wsPort int
|
||||||
verbosity int
|
verbosity int
|
||||||
timeout int
|
timeout int
|
||||||
pssMessageCount int
|
pssMessageTimeout int
|
||||||
pssMessageSize int
|
pssMessageCount int
|
||||||
|
pssMessageSize int
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
@ -84,6 +85,12 @@ func main() {
|
||||||
Usage: "timeout in seconds after which kill the process",
|
Usage: "timeout in seconds after which kill the process",
|
||||||
Destination: &timeout,
|
Destination: &timeout,
|
||||||
},
|
},
|
||||||
|
cli.IntFlag{
|
||||||
|
Name: "msgtimeout",
|
||||||
|
Value: 1,
|
||||||
|
Usage: "timeout in seconds until a message is received",
|
||||||
|
Destination: &pssMessageTimeout,
|
||||||
|
},
|
||||||
cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "msgcount",
|
Name: "msgcount",
|
||||||
Value: 10,
|
Value: 10,
|
||||||
|
|
@ -128,7 +135,7 @@ func main() {
|
||||||
{
|
{
|
||||||
Name: "all",
|
Name: "all",
|
||||||
Usage: "send and receive raw, sym and asym messages across randome nodes",
|
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)
|
return fmt.Errorf("message mismatch. expected: %s got: %s", resJob.msg, res.Msg)
|
||||||
}
|
}
|
||||||
log.Debug("got msg", "job", hexutil.Encode([]byte(resIdx)))
|
log.Debug("got msg", "job", hexutil.Encode([]byte(resIdx)))
|
||||||
case <-time.After(1 * time.Second):
|
case <-time.After(time.Duration(pssMessageTimeout) * time.Second):
|
||||||
return errors.New("msg timeout after 1 sec")
|
return fmt.Errorf("message timeout after %d sec", pssMessageTimeout)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue