1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-29 17:36:38 +08:00

fix(net) use NetMessage interface

This commit is contained in:
Brian Tiger Chow
2014-09-14 05:24:59 -07:00
parent 556da76b2c
commit 68216245c6
3 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ type Network interface {
GetProtocols() *mux.ProtocolMap
// SendMessage sends given Message out
SendMessage(*msg.Message) error
SendMessage(msg.NetMessage) error
// Close terminates all network operation
Close() error

View File

@ -86,7 +86,7 @@ func (n *IpfsNetwork) GetProtocols() *mux.ProtocolMap {
}
// SendMessage sends given Message out
func (n *IpfsNetwork) SendMessage(m *msg.Message) error {
func (n *IpfsNetwork) SendMessage(m msg.NetMessage) error {
n.swarm.Outgoing <- m
return nil
}

View File

@ -153,7 +153,7 @@ func (s *Swarm) fanOut() {
}
s.connsLock.RLock()
conn, found := s.conns[msg.Peer.Key()]
conn, found := s.conns[msg.Peer().Key()]
s.connsLock.RUnlock()
if !found {
@ -164,7 +164,7 @@ func (s *Swarm) fanOut() {
}
// queue it in the connection's buffer
conn.Outgoing.MsgChan <- msg.Data
conn.Outgoing.MsgChan <- msg.Data()
}
}
}
@ -189,7 +189,7 @@ func (s *Swarm) fanIn(c *conn.Conn) {
goto out
}
msg := &msg.Message{Peer: c.Peer, Data: data}
msg := msg.New(c.Peer, data)
s.Incoming <- msg
}
}