예제 #1
0
파일: client.go 프로젝트: sourabhg/goshire
//does the actual call, returning the connection and the internal request
func (this *JsonClient) doApiCall(conn *cheshireConn, req *cheshire.Request, responseChan chan *cheshire.Response, errorChan chan error) (*cheshireRequest, error) {
	if conn == nil {
		return nil, fmt.Errorf("Cannot do api call, conn is nil")
	}
	if req.TxnId() == "" {
		req.SetTxnId(NewTxnId())
	}
	r, err := conn.sendRequest(req, responseChan, errorChan)
	return r, err
}
예제 #2
0
파일: client.go 프로젝트: trendrr/goshire
//does the actual call, returning the connection and the internal request
func (this *JsonClient) doApiCall(req *cheshire.Request, responseChan chan *cheshire.Response, errorChan chan error) (*cheshireRequest, error) {
	conn, err := this.connection()
	if err != nil {
		return nil, err
	}
	if req.TxnId() == "" {
		req.SetTxnId(cheshire.NewTxnId())
	}
	r, err := conn.sendRequest(req, responseChan, errorChan)
	if err == nil {
		this.pool.Return(conn)
	} else {
		this.pool.ReturnBroken(conn)
	}
	return r, err
}