fix: setStreamHandler before connect
This commit is contained in:
parent
9c33816c90
commit
1fd2be1329
@ -31,11 +31,11 @@ var helloCmd = &cli.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
h.SetStreamHandler(hello.ProtocolID, HandleStream)
|
||||||
err = h.Connect(ctx, pis[0])
|
err = h.Connect(ctx, pis[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
h.SetStreamHandler(hello.ProtocolID, HandleStream)
|
|
||||||
ctx, done := context.WithTimeout(ctx, 5*time.Second)
|
ctx, done := context.WithTimeout(ctx, 5*time.Second)
|
||||||
defer done()
|
defer done()
|
||||||
select {
|
select {
|
||||||
|
Loading…
Reference in New Issue
Block a user