Skip to content

Commit

Permalink
Merge pull request #84 from libp2p/chore/fixup
Browse files Browse the repository at this point in the history
Fixup tests & vet
  • Loading branch information
Stebalien authored Jul 15, 2021
2 parents 635d623 + 2f55bf5 commit 1807147
Show file tree
Hide file tree
Showing 6 changed files with 764 additions and 235 deletions.
16 changes: 14 additions & 2 deletions interop/go/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"fmt"
"io"
"io/ioutil"
Expand All @@ -18,6 +19,10 @@ func main() {
if err != nil {
panic(err)
}

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

sess := mplex.NewMultiplex(conn, true)
defer sess.Close()

Expand All @@ -28,7 +33,7 @@ func main() {

go func() {
defer wg.Done()
s, err := sess.NewStream()
s, err := sess.NewStream(ctx)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -60,7 +65,10 @@ func readWrite(s *mplex.Stream) {
panic(err)
}
}
s.Close()
err := s.CloseWrite()
if err != nil {
panic(err)
}
}()
go func() {
defer wg.Done()
Expand All @@ -84,4 +92,8 @@ func readWrite(s *mplex.Stream) {
}
}()
wg.Wait()
err := s.Close()
if err != nil {
panic(err)
}
}
Loading

0 comments on commit 1807147

Please sign in to comment.