Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Commit 83ac1d3

Browse files
add a context to OpenStream and NewStream (#172)
* add a context to MuxedConn.OpenStream * add a context to Conn.NewStream
1 parent a39b84e commit 83ac1d3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

mux/mux.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package mux
66

77
import (
8+
"context"
89
"errors"
910
"io"
1011
"net"
@@ -74,7 +75,7 @@ type MuxedConn interface {
7475
IsClosed() bool
7576

7677
// OpenStream creates a new stream.
77-
OpenStream() (MuxedStream, error)
78+
OpenStream(context.Context) (MuxedStream, error)
7879

7980
// AcceptStream accepts a stream opened by the other side.
8081
AcceptStream() (MuxedStream, error)

network/conn.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package network
22

33
import (
4+
"context"
45
"io"
56

67
ic "github.com/libp2p/go-libp2p-core/crypto"
@@ -24,7 +25,7 @@ type Conn interface {
2425
ID() string
2526

2627
// NewStream constructs a new Stream over this conn.
27-
NewStream() (Stream, error)
28+
NewStream(context.Context) (Stream, error)
2829

2930
// GetStreams returns all open streams over this conn.
3031
GetStreams() []Stream

0 commit comments

Comments
 (0)