Skip to content

Commit

Permalink
coreapi swarm: swarm refactor fixes
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
  • Loading branch information
magik6k committed Sep 11, 2018
1 parent 2f667c6 commit 8333fa8
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions core/coreapi/swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ func (api *SwarmAPI) Connect(ctx context.Context, addr ma.Multiaddr) error {
return coreiface.ErrOffline
}

snet, ok := api.node.PeerHost.Network().(*swarm.Network)
swrm, ok := api.node.PeerHost.Network().(*swarm.Swarm)
if !ok {
return fmt.Errorf("peerhost network was not swarm")
}

swrm := snet.Swarm()

ia, err := iaddr.ParseMultiaddr(ma.Multiaddr(addr))
if err != nil {
return err
Expand Down Expand Up @@ -109,10 +107,13 @@ func (api *SwarmAPI) Peers(context.Context) ([]coreiface.PeerInfo, error) {
peer: pid,
}

swcon, ok := c.(*swarm.Conn)
if ok {
ci.muxer = fmt.Sprintf("%T", swcon.StreamConn().Conn())
}
/*
// FIXME(steb):
swcon, ok := c.(*swarm.Conn)
if ok {
ci.muxer = fmt.Sprintf("%T", swcon.StreamConn().Conn())
}
*/

out = append(out, ci)
}
Expand All @@ -133,10 +134,7 @@ func (ci *connInfo) Latency(context.Context) (time.Duration, error) {
}

func (ci *connInfo) Streams(context.Context) ([]string, error) {
streams, err := ci.conn.GetStreams()
if err != nil {
return nil, err
}
streams := ci.conn.GetStreams()

out := make([]string, len(streams))
for i, s := range streams {
Expand Down

0 comments on commit 8333fa8

Please sign in to comment.