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

add a context to OpenStream and NewStream #172

Merged
merged 2 commits into from
Dec 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mux/mux.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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