mirror of
https://github.com/libp2p/go-libp2p.git
synced 2026-04-23 00:27:05 +08:00
docs: fix some comments (#2391)
Co-authored-by: DylanYong <dylan.y@nodereal.io>
This commit is contained in:
@@ -591,7 +591,7 @@ func (h *BasicHost) EventBus() event.Bus {
|
||||
//
|
||||
// host.Mux().SetHandler(proto, handler)
|
||||
//
|
||||
// (Threadsafe)
|
||||
// (Thread-safe)
|
||||
func (h *BasicHost) SetStreamHandler(pid protocol.ID, handler network.StreamHandler) {
|
||||
h.Mux().AddHandler(pid, func(p protocol.ID, rwc io.ReadWriteCloser) error {
|
||||
is := rwc.(network.Stream)
|
||||
@@ -627,7 +627,7 @@ func (h *BasicHost) RemoveStreamHandler(pid protocol.ID) {
|
||||
// NewStream opens a new stream to given peer p, and writes a p2p/protocol
|
||||
// header with given protocol.ID. If there is no connection to p, attempts
|
||||
// to create one. If ProtocolID is "", writes no header.
|
||||
// (Threadsafe)
|
||||
// (Thread-safe)
|
||||
func (h *BasicHost) NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID) (network.Stream, error) {
|
||||
// Ensure we have a connection, with peer addresses resolved by the routing system (#207)
|
||||
// It is not sufficient to let the underlying host connect, it will most likely not have
|
||||
|
||||
Reference in New Issue
Block a user