Skip to content

Commit

Permalink
examples: clonesrv6 typo, ticlient documentation, udpping3 bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
pebbe committed Mar 25, 2021
1 parent 511c6cb commit 8301309
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/clonesrv6.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func main() {
srv.peer = 5556
srv.primary = false
} else {
fmt.Println("Usage: clonesrv4 { -p | -b }")
fmt.Println("Usage: clonesrv6 { -p | -b }")
return
}
// Primary server will become first active
Expand Down
10 changes: 6 additions & 4 deletions examples/intface/intface.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ type agent_t struct {
func new_agent() (agent *agent_t) {

// push output from udp into zmq socket
bcast := &net.UDPAddr{Port: PING_PORT_NUMBER, IP: net.IPv4bcast}
conn, e := net.ListenUDP("udp", bcast)
addr := &net.UDPAddr{Port: PING_PORT_NUMBER, IP: net.IPv4allsys}
conn, e := net.ListenMulticastUDP("udp", nil, addr)
if e != nil {
panic(e)
}
Expand Down Expand Up @@ -139,6 +139,8 @@ func new_agent() (agent *agent_t) {
peers: make(map[string]*peer_t),
}

pipe.SendMessage("AGENT ", uuID.String())

return
}

Expand Down Expand Up @@ -177,7 +179,7 @@ func (agent *agent_t) handle_beacon() (err error) {
uuid_bytes := []byte(msg[0])
if bytes.Compare(uuid_bytes, agent.uuid_bytes) != 0 {
// Find or create peer via its UUID string
uuID, _ := uuid.ParseBytes(uuid_bytes)
uuID, _ := uuid.FromBytes(uuid_bytes)
uuid_string := uuID.String()
peer, ok := agent.peers[uuid_string]
if !ok {
Expand All @@ -199,7 +201,7 @@ func (agent *agent_t) handle_beacon() (err error) {
func (agent *agent_t) reap_peer(peer *peer_t) {
if time.Now().After(peer.expires_at) {
// Report peer left the network
agent.pipe.SendMessage("LEFT", peer.uuid_string)
agent.pipe.SendMessage("LEFT ", peer.uuid_string)
delete(agent.peers, peer.uuid_string)
}
}
Expand Down
6 changes: 6 additions & 0 deletions examples/ticlient.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
// Titanic client example.
// Implements client side of http://rfc.zeromq.org/spec:9

// To use this example:
// 1. start mdbroker
// 2. start mdworker
// 3. start titanic
// 4. run ticlient

package main

import (
Expand Down

0 comments on commit 8301309

Please sign in to comment.