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 @@
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)
......
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
......
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