示例#1
0
文件: push.go 项目: iwarsong/bearded
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()
}
示例#2
0
文件: pair.go 项目: iwarsong/bearded
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()
}
示例#3
0
文件: req.go 项目: iwarsong/bearded
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()
}