@cryptotaxi247 / kubo / commits / 7d6a58308

Fix #1 build errors.

Carlos Cobo committed Jul 24, 2014 at 14:30 UTC 7d6a58308b977273ab03ad0e0235cddf9e0fcb58
3 files changed +21 -25
bitswap/bitswap.go
+4 -3
@@ -1,7 +1,8 @@
1 package bitswap
2
3 import (
4 - peer "github.com/jbenet/go-ipfs/peer"
4 + "github.com/jbenet/go-ipfs/blocks"
5 + "github.com/jbenet/go-multihash"
6 )
7
8 // aliases
@@ -11,7 +12,7 @@ type Ledger struct {
12 }
13
14 type BitSwap struct {
14 - Ledgers map[peer.ID]*Ledger
15 - HaveList map[multihash.Multihash]*block.Block
15 + Ledgers map[string]*Ledger
16 + HaveList map[string]*blocks.Block
17 WantList []*multihash.Multihash
18 }
netmux/interface.go
+14 -14
@@ -13,38 +13,38 @@ type Interface struct {
13 Network string
14
15 // Own network address
16 - Address string
17 - ResolvedAddress string
16 + Address string
17 + ResolvedAddress *net.UDPAddr
18
19 // Connection
20 - conn *net.Conn
20 + conn net.Conn
21
22 // next packets + close control channels
23 - Input chan *Packet
23 + Input chan *Packet
24 Output chan *Packet
25 Closed chan bool
26 Errors chan error
27 }
28
29 -func NewUDPInterface(net, addr string) (*Interface, error) {
30 - raddr, err := net.ResolveUDPAddr(net, addr)
29 +func NewUDPInterface(network, addr string) (*Interface, error) {
30 + raddr, err := net.ResolveUDPAddr(network, addr)
31 if err != nil {
32 return nil, err
33 }
34
35 - conn, err := net.ListenUDP(net, addr)
35 + conn, err := net.ListenUDP(network, raddr)
36 if err != nil {
37 return nil, err
38 }
39
40 i := &Interface{
41 - Network: net,
41 + Network: network,
42 Address: addr,
43 ResolvedAddress: raddr,
44 conn: conn,
45 }
46
47 - go i.processInput()
47 + go i.processUDPInput()
48 go i.processOutput()
49 return i, nil
50 }
@@ -53,10 +53,10 @@ func (i *Interface) processOutput() {
53 for {
54 select {
55 case <-i.Closed:
56 - break;
56 + break
57
58 case buffer := <-i.Output:
59 - i.conn.Write([]byte(buffer))
59 + i.conn.Write([]byte(buffer.Data))
60 }
61 }
62 }
@@ -64,15 +64,15 @@ func (i *Interface) processOutput() {
64 func (i *Interface) processUDPInput() {
65 for {
66 select {
67 - case <- i.Closed:
68 - break;
67 + case <-i.Closed:
68 + break
69
70 }
71 }
72 }
73
74 func (i *Interface) Read(buffer []byte) bool {
75 - n, err := i.Conn.Read(buffer)
75 + _, err := i.conn.Read(buffer)
76 if err != nil {
77 i.Errors <- err
78 i.Close()
netmux/netmux.go
+3 -8
@@ -1,9 +1,5 @@
1 package netmux
2
3 -import (
4 - "net"
5 -)
6 -
3 // The netmux module provides a "network multiplexer".
4 // The core idea is to have the client be able to connect to
5 // many different networks (potentially over different transports)
@@ -22,9 +18,8 @@ type Netmux struct {
18 outgoingSrc <-chan *Packet
19 }
20
25 -
21 // Warning: will probably change to adopt multiaddr format
27 -type Packet {
22 +type Packet struct {
23 // the network addresses to send to
24 // e.g. tcp4://127.0.0.1:12345
25 NetAddrTo string
@@ -44,8 +39,8 @@ func NewNetmux() *Netmux {
39 // setup channels
40 och := make(chan *Packet)
41 ich := make(chan *Packet)
47 - n.Incoming, n.incomingSrc := ich, ich
48 - n.Outgoing, n.outgoingSrc := och, och
42 + n.Incoming, n.incomingSrc = ich, ich
43 + n.Outgoing, n.outgoingSrc = och, och
44
45 return n
46 }