fix: setStreamHandler before connect

This commit is contained in:
swift-mx 2022-06-02 19:59:52 +08:00
parent 9c33816c90
commit 1fd2be1329

View File

@ -31,11 +31,11 @@ var helloCmd = &cli.Command{
if err != nil {
return err
}
h.SetStreamHandler(hello.ProtocolID, HandleStream)
err = h.Connect(ctx, pis[0])
if err != nil {
return err
}
h.SetStreamHandler(hello.ProtocolID, HandleStream)
ctx, done := context.WithTimeout(ctx, 5*time.Second)
defer done()
select {