mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2024-12-26 23:30:27 +08:00
add a context to OpenStream and NewStream (#172)
* add a context to MuxedConn.OpenStream * add a context to Conn.NewStream
This commit is contained in:
parent
a39b84ea2e
commit
83ac1d370d
@ -5,6 +5,7 @@
|
||||
package mux
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
@ -74,7 +75,7 @@ type MuxedConn interface {
|
||||
IsClosed() bool
|
||||
|
||||
// OpenStream creates a new stream.
|
||||
OpenStream() (MuxedStream, error)
|
||||
OpenStream(context.Context) (MuxedStream, error)
|
||||
|
||||
// AcceptStream accepts a stream opened by the other side.
|
||||
AcceptStream() (MuxedStream, error)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package network
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
ic "github.com/libp2p/go-libp2p-core/crypto"
|
||||
@ -24,7 +25,7 @@ type Conn interface {
|
||||
ID() string
|
||||
|
||||
// NewStream constructs a new Stream over this conn.
|
||||
NewStream() (Stream, error)
|
||||
NewStream(context.Context) (Stream, error)
|
||||
|
||||
// GetStreams returns all open streams over this conn.
|
||||
GetStreams() []Stream
|
||||
|
Loading…
Reference in New Issue
Block a user