pebbe / zmq4

A Go interface to ZeroMQ version 4
BSD 2-Clause "Simplified" License
1.17k stars 163 forks source link

Fixed reactor handler function declaration #65

Closed webconnme closed 8 years ago

webconnme commented 8 years ago

Added an argument on reactor handler function.

AS IS:

var global_socket * zmq.Socket

func socket_handler (state zmq.State) {
  if state == zmq.POLLIN {
    str := global_sock.recv(0)
    fmt.Println("Recevied: " + str)
  }
}

TO BE:

func socket_handler (sock *zmq.Socket, state zmq.State) {
  if state == zmq.POLLIN {
    str := sock.recv(0)
    fmt.Println("Recevied: " + str)
  }
}
pebbe commented 8 years ago

This is unnecessary and would break existing code.

See examples/clonesrv5.go, examples/lbbroker3.go, and examples/bstar/bstar.go for usage examples.