This repository has been archived by the owner on May 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
997 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,14 @@ | ||
// Deprecated: This package has moved into go-libp2p as a sub-package: github.com/libp2p/go-libp2p/p2p/muxer/yamux. | ||
package sm_yamux | ||
|
||
import ( | ||
"io/ioutil" | ||
"math" | ||
"net" | ||
|
||
"github.com/libp2p/go-libp2p-core/network" | ||
|
||
"github.com/libp2p/go-yamux/v3" | ||
"github.com/libp2p/go-libp2p/p2p/muxer/yamux" | ||
) | ||
|
||
var DefaultTransport *Transport | ||
|
||
func init() { | ||
config := yamux.DefaultConfig() | ||
// We've bumped this to 16MiB as this critically limits throughput. | ||
// | ||
// 1MiB means a best case of 10MiB/s (83.89Mbps) on a connection with | ||
// 100ms latency. The default gave us 2.4MiB *best case* which was | ||
// totally unacceptable. | ||
config.MaxStreamWindowSize = uint32(16 * 1024 * 1024) | ||
// don't spam | ||
config.LogOutput = ioutil.Discard | ||
// We always run over a security transport that buffers internally | ||
// (i.e., uses a block cipher). | ||
config.ReadBufSize = 0 | ||
// Effectively disable the incoming streams limit. | ||
// This is now dynamically limited by the resource manager. | ||
config.MaxIncomingStreams = math.MaxUint32 | ||
DefaultTransport = (*Transport)(config) | ||
} | ||
// Deprecated: use github.com/libp2p/go-libp2p/p2p/muxer/yamux.DefaultTransport instead. | ||
var DefaultTransport = yamux.DefaultTransport | ||
|
||
// Transport implements mux.Multiplexer that constructs | ||
// yamux-backed muxed connections. | ||
type Transport yamux.Config | ||
|
||
var _ network.Multiplexer = &Transport{} | ||
|
||
func (t *Transport) NewConn(nc net.Conn, isServer bool, scope network.PeerScope) (network.MuxedConn, error) { | ||
var s *yamux.Session | ||
var err error | ||
if isServer { | ||
s, err = yamux.Server(nc, t.Config(), scope) | ||
} else { | ||
s, err = yamux.Client(nc, t.Config(), scope) | ||
} | ||
return (*conn)(s), err | ||
} | ||
|
||
func (t *Transport) Config() *yamux.Config { | ||
return (*yamux.Config)(t) | ||
} | ||
// Deprecated: use github.com/libp2p/go-libp2p/p2p/muxer/yamux.Transport instead. | ||
type Transport = yamux.Transport |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"version": "v0.9.1" | ||
"version": "v0.10.0" | ||
} |