Example #1
0
func (s *Session) BackendsStatus(addr *DnetAddr) *DChannel {
	responseCh := NewDChannel()
	context := NextContext()

	onFinish := func(tmp *DnetBackendsStatus) {
		responseCh.In <- tmp
		close(responseCh.In)
		Pool.Delete(context)
	}
	Pool.Store(context, onFinish)

	var tmp *C.struct_dnet_addr = C.dnet_addr_alloc()
	defer C.dnet_addr_free(tmp)
	addr.CAddr(tmp)
	C.session_backends_status(s.session, tmp, C.context_t(context))

	return responseCh
}
Example #2
0
func (s *Session) BackendsStatus(addr *DnetAddr) <-chan *DnetBackendsStatus {
	responseCh := make(chan *DnetBackendsStatus, defaultVOLUME)
	context := NextContext()

	onFinish := func(tmp *DnetBackendsStatus) {
		responseCh <- tmp
		close(responseCh)
		Pool.Delete(context)
	}
	Pool.Store(context, onFinish)

	var tmp *C.struct_dnet_addr = C.dnet_addr_alloc()
	defer C.dnet_addr_free(tmp)
	addr.CAddr(tmp)
	C.session_backends_status(s.session, tmp, C.context_t(context))

	return responseCh
}