Skip to content

Commit 19f373e

Browse files
committed
Add examples
1 parent e033439 commit 19f373e

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

example/chat/dial/main.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,8 @@ func main() {
6767
stream, err := econn.OpenStream()
6868
util.Check(err)
6969

70-
stream2, err := econn.OpenStream()
71-
util.Check(err)
72-
7370
fmt.Println("Connected; type 'exit' to shutdown gracefully")
7471

75-
stream2.Write([]byte("testt\n"))
76-
7772
// Simulate a chat session
7873
util.Chat(stream)
7974

example/chat/listen/main.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"fmt"
1414
"math/big"
1515
"net"
16-
"time"
1716

1817
"github.com/pion/dtls/v3/examples/util"
1918
quic "github.com/refraction-networking/uquic"
@@ -66,15 +65,11 @@ func main() {
6665
continue
6766
}
6867

69-
for i := 0; i < 2; i++ {
70-
ctx, _ := context.WithTimeout(context.Background(), 1*time.Second)
71-
stream, err := econn.AcceptStream(ctx)
72-
if err != nil {
73-
continue
74-
}
75-
hub.Register(&streamConn{Stream: stream, Connection: econn})
76-
68+
stream, err := econn.AcceptStream(context.Background())
69+
if err != nil {
70+
continue
7771
}
72+
hub.Register(&streamConn{Stream: stream, Connection: econn})
7873

7974
// `conn` is of type `net.Conn` but may be casted to `dtls.Conn`
8075
// using `dtlsConn := conn.(*dtls.Conn)` in order to to expose

0 commit comments

Comments
 (0)