func()

in hyperbahn/gen-go/hyperbahn/hyperbahn.go [80:131]


func (p *HyperbahnClient) recvDiscover() (value *DiscoveryResult_, err error) {
	iprot := p.InputProtocol
	if iprot == nil {
		iprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.InputProtocol = iprot
	}
	method, mTypeId, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return
	}
	if method != "discover" {
		err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "discover failed: wrong method name")
		return
	}
	if p.SeqId != seqId {
		err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "discover failed: out of sequence response")
		return
	}
	if mTypeId == thrift.EXCEPTION {
		error1 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
		var error2 error
		error2, err = error1.Read(iprot)
		if err != nil {
			return
		}
		if err = iprot.ReadMessageEnd(); err != nil {
			return
		}
		err = error2
		return
	}
	if mTypeId != thrift.REPLY {
		err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "discover failed: invalid message type")
		return
	}
	result := HyperbahnDiscoverResult{}
	if err = result.Read(iprot); err != nil {
		return
	}
	if err = iprot.ReadMessageEnd(); err != nil {
		return
	}
	if result.NoPeersAvailable != nil {
		err = result.NoPeersAvailable
		return
	} else if result.InvalidServiceName != nil {
		err = result.InvalidServiceName
		return
	}
	value = result.GetSuccess()
	return
}