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

Commit

Permalink
add a context to OpenStream and NewStream (#172)
Browse files Browse the repository at this point in the history
* add a context to MuxedConn.OpenStream

* add a context to Conn.NewStream
  • Loading branch information
marten-seemann committed Dec 19, 2020
1 parent a39b84e commit 83ac1d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion mux/mux.go
Expand Up @@ -5,6 +5,7 @@
package mux

import (
"context"
"errors"
"io"
"net"
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion network/conn.go
@@ -1,6 +1,7 @@
package network

import (
"context"
"io"

ic "github.com/libp2p/go-libp2p-core/crypto"
Expand All @@ -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
Expand Down

0 comments on commit 83ac1d3

Please sign in to comment.