提交 03904074 作者: Jeromy

use correct protocol names for ipfs services

License: MIT
Signed-off-by: 's avatarJeromy <why@ipfs.io>
上级 594ae64f
...@@ -26,7 +26,8 @@ import ( ...@@ -26,7 +26,8 @@ import (
var log = logging.Logger("diagnostics") var log = logging.Logger("diagnostics")
// ProtocolDiag is the diagnostics protocol.ID // ProtocolDiag is the diagnostics protocol.ID
var ProtocolDiag protocol.ID = "/ipfs/diagnostics" var ProtocolDiag protocol.ID = "/ipfs/diag/net/1.0.0"
var ProtocolDiagOld protocol.ID = "/ipfs/diagnostics"
var ErrAlreadyRunning = errors.New("diagnostic with that ID already running") var ErrAlreadyRunning = errors.New("diagnostic with that ID already running")
...@@ -54,6 +55,7 @@ func NewDiagnostics(self peer.ID, h host.Host) *Diagnostics { ...@@ -54,6 +55,7 @@ func NewDiagnostics(self peer.ID, h host.Host) *Diagnostics {
} }
h.SetStreamHandler(ProtocolDiag, d.handleNewStream) h.SetStreamHandler(ProtocolDiag, d.handleNewStream)
h.SetStreamHandler(ProtocolDiagOld, d.handleNewStream)
return d return d
} }
...@@ -203,7 +205,7 @@ func (d *Diagnostics) getDiagnosticFromPeers(ctx context.Context, peers map[peer ...@@ -203,7 +205,7 @@ func (d *Diagnostics) getDiagnosticFromPeers(ctx context.Context, peers map[peer
} }
func (d *Diagnostics) getDiagnosticFromPeer(ctx context.Context, p peer.ID, pmes *pb.Message) (<-chan *DiagInfo, error) { func (d *Diagnostics) getDiagnosticFromPeer(ctx context.Context, p peer.ID, pmes *pb.Message) (<-chan *DiagInfo, error) {
s, err := d.host.NewStream(ctx, p, ProtocolDiag) s, err := d.host.NewStream(ctx, p, ProtocolDiag, ProtocolDiagOld)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -8,7 +8,8 @@ import ( ...@@ -8,7 +8,8 @@ import (
protocol "gx/ipfs/Qmf4ETeAWXuThBfWwonVyFqGFSgTWepUDEr1txcctvpTXS/go-libp2p/p2p/protocol" protocol "gx/ipfs/Qmf4ETeAWXuThBfWwonVyFqGFSgTWepUDEr1txcctvpTXS/go-libp2p/p2p/protocol"
) )
var ProtocolBitswap protocol.ID = "/ipfs/bitswap" var ProtocolBitswap protocol.ID = "/ipfs/bitswap/1.0.0"
var ProtocolBitswapOld protocol.ID = "/ipfs/bitswap"
// BitSwapNetwork provides network connectivity for BitSwap sessions // BitSwapNetwork provides network connectivity for BitSwap sessions
type BitSwapNetwork interface { type BitSwapNetwork interface {
......
...@@ -26,7 +26,7 @@ func NewFromIpfsHost(host host.Host, r routing.ContentRouting) BitSwapNetwork { ...@@ -26,7 +26,7 @@ func NewFromIpfsHost(host host.Host, r routing.ContentRouting) BitSwapNetwork {
routing: r, routing: r,
} }
host.SetStreamHandler(ProtocolBitswap, bitswapNetwork.handleNewStream) host.SetStreamHandler(ProtocolBitswap, bitswapNetwork.handleNewStream)
host.SetStreamHandler("/bitswap/1.0.0", bitswapNetwork.handleNewStream) host.SetStreamHandler(ProtocolBitswapOld, bitswapNetwork.handleNewStream)
host.Network().Notify((*netNotifiee)(&bitswapNetwork)) host.Network().Notify((*netNotifiee)(&bitswapNetwork))
// TODO: StopNotify. // TODO: StopNotify.
...@@ -73,7 +73,7 @@ func (bsnet *impl) newStreamToPeer(ctx context.Context, p peer.ID) (inet.Stream, ...@@ -73,7 +73,7 @@ func (bsnet *impl) newStreamToPeer(ctx context.Context, p peer.ID) (inet.Stream,
return nil, err return nil, err
} }
return bsnet.host.NewStream(ctx, p, "/bitswap/1.0.0", ProtocolBitswap) return bsnet.host.NewStream(ctx, p, ProtocolBitswap, ProtocolBitswapOld)
} }
func (bsnet *impl) SendMessage( func (bsnet *impl) SendMessage(
......
...@@ -31,7 +31,8 @@ import ( ...@@ -31,7 +31,8 @@ import (
var log = logging.Logger("dht") var log = logging.Logger("dht")
var ProtocolDHT protocol.ID = "/ipfs/dht" var ProtocolDHT protocol.ID = "/ipfs/kad/1.0.0"
var ProtocolDHTOld protocol.ID = "/ipfs/dht"
// NumBootstrapQueries defines the number of random dht queries to do to // NumBootstrapQueries defines the number of random dht queries to do to
// collect members of the routing table. // collect members of the routing table.
...@@ -85,6 +86,7 @@ func NewDHT(ctx context.Context, h host.Host, dstore ds.Batching) *IpfsDHT { ...@@ -85,6 +86,7 @@ func NewDHT(ctx context.Context, h host.Host, dstore ds.Batching) *IpfsDHT {
dht.ctx = ctx dht.ctx = ctx
h.SetStreamHandler(ProtocolDHT, dht.handleNewStream) h.SetStreamHandler(ProtocolDHT, dht.handleNewStream)
h.SetStreamHandler(ProtocolDHTOld, dht.handleNewStream)
dht.providers = providers.NewProviderManager(dht.ctx, dht.self, dstore) dht.providers = providers.NewProviderManager(dht.ctx, dht.self, dstore)
dht.proc.AddChild(dht.providers.Process()) dht.proc.AddChild(dht.providers.Process())
goprocessctx.CloseAfterContext(dht.proc, ctx) goprocessctx.CloseAfterContext(dht.proc, ctx)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论