mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2024-12-27 23:40:11 +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
|
package mux
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
@ -74,7 +75,7 @@ type MuxedConn interface {
|
|||||||
IsClosed() bool
|
IsClosed() bool
|
||||||
|
|
||||||
// OpenStream creates a new stream.
|
// OpenStream creates a new stream.
|
||||||
OpenStream() (MuxedStream, error)
|
OpenStream(context.Context) (MuxedStream, error)
|
||||||
|
|
||||||
// AcceptStream accepts a stream opened by the other side.
|
// AcceptStream accepts a stream opened by the other side.
|
||||||
AcceptStream() (MuxedStream, error)
|
AcceptStream() (MuxedStream, error)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package network
|
package network
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
ic "github.com/libp2p/go-libp2p-core/crypto"
|
ic "github.com/libp2p/go-libp2p-core/crypto"
|
||||||
@ -24,7 +25,7 @@ type Conn interface {
|
|||||||
ID() string
|
ID() string
|
||||||
|
|
||||||
// NewStream constructs a new Stream over this conn.
|
// 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 returns all open streams over this conn.
|
||||||
GetStreams() []Stream
|
GetStreams() []Stream
|
||||||
|
Loading…
Reference in New Issue
Block a user