Unverified Commit 83ac1d37 authored by Marten Seemann's avatar Marten Seemann Committed by GitHub

add a context to OpenStream and NewStream (#172)

* add a context to MuxedConn.OpenStream

* add a context to Conn.NewStream
parent a39b84ea
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package mux package mux
import ( import (
"context"
"errors" "errors"
"io" "io"
"net" "net"
...@@ -74,7 +75,7 @@ type MuxedConn interface { ...@@ -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)
......
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 { ...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment