From 38f35ecd24000e0dae9c555322e1b24c465d72ce Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Wed, 30 Jul 2014 00:34:29 -0700 Subject: [PATCH 1/3] travis ci --- .travis.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..0cf82e01d2a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: go + +go: + - 1.1 + - 1.2 + - 1.3 + - release + - tip + +script: + - go test -v ./... From b784614c2173090d2740b4613732fce0f090bffd Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Wed, 30 Jul 2014 01:13:47 -0700 Subject: [PATCH 2/3] fixed build errs netmux got replaced for the most part by swarm. --- bitswap/bitswap.go | 18 ++++----- netmux/interface.go | 96 --------------------------------------------- netmux/netmux.go | 46 ---------------------- 3 files changed, 7 insertions(+), 153 deletions(-) delete mode 100644 netmux/interface.go delete mode 100644 netmux/netmux.go diff --git a/bitswap/bitswap.go b/bitswap/bitswap.go index cab466f988a..737f43e63de 100644 --- a/bitswap/bitswap.go +++ b/bitswap/bitswap.go @@ -1,28 +1,24 @@ package bitswap import ( - "github.com/jbenet/go-ipfs/blocks" - mh "github.com/jbenet/go-multihash" - - "time" + "time" + mh "github.com/jbenet/go-multihash" + blocks "github.com/jbenet/go-ipfs/blocks" + u "github.com/jbenet/go-ipfs/util" ) // aliases type Ledger struct { Owner mh.Multihash - Partner mh.Multihash - BytesSent uint64 - BytesRecv uint64 - Timestamp *time.Time } type BitSwap struct { - Ledgers map[string]*Ledger - HaveList map[string]*blocks.Block - WantList []*multihash.Multihash + Ledgers map[u.Key]*Ledger // key is peer.ID + HaveList map[u.Key]*blocks.Block // key is multihash + WantList []*mh.Multihash } diff --git a/netmux/interface.go b/netmux/interface.go deleted file mode 100644 index a1aa9b96015..00000000000 --- a/netmux/interface.go +++ /dev/null @@ -1,96 +0,0 @@ -package netmux - -import ( - "net" -) - -// An interface is the module connecting netmux -// to various networks (tcp, udp, webrtc, etc). -// It keeps the relevant connections open. -type Interface struct { - - // Interface network (e.g. udp4, tcp6) - Network string - - // Own network address - Address string - ResolvedAddress *net.UDPAddr - - // Connection - conn net.Conn - - // next packets + close control channels - Input chan *Packet - Output chan *Packet - Closed chan bool - Errors chan error -} - -func NewUDPInterface(network, addr string) (*Interface, error) { - raddr, err := net.ResolveUDPAddr(network, addr) - if err != nil { - return nil, err - } - - conn, err := net.ListenUDP(network, raddr) - if err != nil { - return nil, err - } - - i := &Interface{ - Network: network, - Address: addr, - ResolvedAddress: raddr, - conn: conn, - } - - go i.processUDPInput() - go i.processOutput() - return i, nil -} - -func (i *Interface) processOutput() { - for { - select { - case <-i.Closed: - break - - case buffer := <-i.Output: - i.conn.Write([]byte(buffer.Data)) - } - } -} - -func (i *Interface) processUDPInput() { - for { - select { - case <-i.Closed: - break - - } - } -} - -func (i *Interface) Read(buffer []byte) bool { - _, err := i.conn.Read(buffer) - if err != nil { - i.Errors <- err - i.Close() - return false - } - return true -} - -func (i *Interface) Close() { - // closing net connection - err := i.conn.Close() - if err != nil { - i.Errors <- err - } - - // closing channels - close(i.Input) - close(i.Output) - close(i.Closed) - close(i.Errors) -} diff --git a/netmux/netmux.go b/netmux/netmux.go deleted file mode 100644 index d5a98a5f4fb..00000000000 --- a/netmux/netmux.go +++ /dev/null @@ -1,46 +0,0 @@ -package netmux - -// 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) -// and multiplex everything over one interface. - -type Netmux struct { - // the list of NetMux interfaces - Interfaces []*Interface - - // The channels to send/recv from - Incoming <-chan *Packet - Outgoing chan<- *Packet - - // internally managed other side of channels - incomingSrc chan<- *Packet - outgoingSrc <-chan *Packet -} - -// Warning: will probably change to adopt multiaddr format -type Packet struct { - // the network addresses to send to - // e.g. tcp4://127.0.0.1:12345 - NetAddrTo string - - // the network addresses to recv from - // e.g. tcp4://127.0.0.1:12345 - // may be left blank to select one automatically. - NetAddrFrom string - - // the data to send. - Data []byte -} - -func NewNetmux() *Netmux { - n := &Netmux{} - - // setup channels - och := make(chan *Packet) - ich := make(chan *Packet) - n.Incoming, n.incomingSrc = ich, ich - n.Outgoing, n.outgoingSrc = och, och - - return n -} From 7a283230362c05c26d793c0866613208e56e6bb2 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Wed, 30 Jul 2014 01:31:56 -0700 Subject: [PATCH 3/3] 1.1 fails with multihash --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0cf82e01d2a..32ce5a78639 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: go go: - - 1.1 - 1.2 - 1.3 - release