Exemplo n.º 1
0
func (x *push) sender(ep mangos.Endpoint) {
	sq := x.sock.SendChannel()

	for {
		m := <-sq
		if m == nil {
			break
		}

		if ep.SendMsg(m) != nil {
			m.Free()
			break
		}
	}

	x.senders.Done()
}
Exemplo n.º 2
0
func (x *pair) sender(ep mangos.Endpoint) {

	sq := x.sock.SendChannel()

	// This is pretty easy because we have only one peer at a time.
	// If the peer goes away, we'll just drop the message on the floor.
	for {
		m := <-sq
		if m == nil {
			break
		}

		if ep.SendMsg(m) != nil {
			m.Free()
			break
		}
	}

	x.senders.Done()
}
Exemplo n.º 3
0
func (r *req) sender(ep mangos.Endpoint) {

	sq := r.sock.SendChannel()

	for {
		var m *mangos.Message

		select {
		case m = <-r.resend:
		case m = <-sq:
		}
		if m == nil {
			break
		}

		if ep.SendMsg(m) != nil {
			r.resend <- m
			break
		}
	}

	r.senders.Done()
}