Skip to content

Commit

Permalink
Fix #1 build errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
toqueteos committed Jul 24, 2014
1 parent 1fb29a2 commit 7d6a583
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
7 changes: 4 additions & 3 deletions bitswap/bitswap.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package bitswap

import (
peer "github.com/jbenet/go-ipfs/peer"
"github.com/jbenet/go-ipfs/blocks"
"github.com/jbenet/go-multihash"
)

// aliases
Expand All @@ -11,7 +12,7 @@ type Ledger struct {
}

type BitSwap struct {
Ledgers map[peer.ID]*Ledger
HaveList map[multihash.Multihash]*block.Block
Ledgers map[string]*Ledger
HaveList map[string]*blocks.Block
WantList []*multihash.Multihash
}
28 changes: 14 additions & 14 deletions netmux/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,38 @@ type Interface struct {
Network string

// Own network address
Address string
ResolvedAddress string
Address string
ResolvedAddress *net.UDPAddr

// Connection
conn *net.Conn
conn net.Conn

// next packets + close control channels
Input chan *Packet
Input chan *Packet
Output chan *Packet
Closed chan bool
Errors chan error
}

func NewUDPInterface(net, addr string) (*Interface, error) {
raddr, err := net.ResolveUDPAddr(net, addr)
func NewUDPInterface(network, addr string) (*Interface, error) {
raddr, err := net.ResolveUDPAddr(network, addr)
if err != nil {
return nil, err
}

conn, err := net.ListenUDP(net, addr)
conn, err := net.ListenUDP(network, raddr)
if err != nil {
return nil, err
}

i := &Interface{
Network: net,
Network: network,
Address: addr,
ResolvedAddress: raddr,
conn: conn,
}

go i.processInput()
go i.processUDPInput()
go i.processOutput()
return i, nil
}
Expand All @@ -53,26 +53,26 @@ func (i *Interface) processOutput() {
for {
select {
case <-i.Closed:
break;
break

case buffer := <-i.Output:
i.conn.Write([]byte(buffer))
i.conn.Write([]byte(buffer.Data))
}
}
}

func (i *Interface) processUDPInput() {
for {
select {
case <- i.Closed:
break;
case <-i.Closed:
break

}
}
}

func (i *Interface) Read(buffer []byte) bool {
n, err := i.Conn.Read(buffer)
_, err := i.conn.Read(buffer)
if err != nil {
i.Errors <- err
i.Close()
Expand Down
11 changes: 3 additions & 8 deletions netmux/netmux.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package netmux

import (
"net"
)

// The netmux module provides a "network multiplexer".
// The core idea is to have the client be able to connect to
// many different networks (potentially over different transports)
Expand All @@ -22,9 +18,8 @@ type Netmux struct {
outgoingSrc <-chan *Packet
}


// Warning: will probably change to adopt multiaddr format
type Packet {
type Packet struct {
// the network addresses to send to
// e.g. tcp4://127.0.0.1:12345
NetAddrTo string
Expand All @@ -44,8 +39,8 @@ func NewNetmux() *Netmux {
// setup channels
och := make(chan *Packet)
ich := make(chan *Packet)
n.Incoming, n.incomingSrc := ich, ich
n.Outgoing, n.outgoingSrc := och, och
n.Incoming, n.incomingSrc = ich, ich
n.Outgoing, n.outgoingSrc = och, och

return n
}

0 comments on commit 7d6a583

Please sign in to comment.