Lines Matching refs:rpc_state
287 struct evrpc_req_generic *rpc_state = NULL; in evrpc_request_cb() local
294 rpc_state = mm_calloc(1, sizeof(struct evrpc_req_generic)); in evrpc_request_cb()
295 if (rpc_state == NULL) in evrpc_request_cb()
297 rpc_state->rpc = rpc; in evrpc_request_cb()
298 rpc_state->http_req = req; in evrpc_request_cb()
299 rpc_state->rpc_data = NULL; in evrpc_request_cb()
304 evrpc_hook_associate_meta(&rpc_state->hook_meta, req->evcon); in evrpc_request_cb()
310 rpc_state, req, req->input_buffer); in evrpc_request_cb()
315 evrpc_pause_request(rpc->base, rpc_state, in evrpc_request_cb()
327 evrpc_request_cb_closure(rpc_state, EVRPC_CONTINUE); in evrpc_request_cb()
331 if (rpc_state != NULL) in evrpc_request_cb()
332 evrpc_reqstate_free(rpc_state); in evrpc_request_cb()
340 struct evrpc_req_generic *rpc_state = arg; in evrpc_request_cb_closure() local
344 EVUTIL_ASSERT(rpc_state); in evrpc_request_cb_closure()
345 rpc = rpc_state->rpc; in evrpc_request_cb_closure()
346 req = rpc_state->http_req; in evrpc_request_cb_closure()
352 rpc_state->request = rpc->request_new(rpc->request_new_arg); in evrpc_request_cb_closure()
353 if (rpc_state->request == NULL) in evrpc_request_cb_closure()
357 rpc_state->request, req->input_buffer) == -1) { in evrpc_request_cb_closure()
364 rpc_state->reply = rpc->reply_new(rpc->reply_new_arg); in evrpc_request_cb_closure()
365 if (rpc_state->reply == NULL) in evrpc_request_cb_closure()
369 rpc->cb(rpc_state, rpc->cb_arg); in evrpc_request_cb_closure()
374 if (rpc_state != NULL) in evrpc_request_cb_closure()
375 evrpc_reqstate_free(rpc_state); in evrpc_request_cb_closure()
382 evrpc_reqstate_free(struct evrpc_req_generic* rpc_state) in evrpc_reqstate_free() argument
385 EVUTIL_ASSERT(rpc_state != NULL); in evrpc_reqstate_free()
386 rpc = rpc_state->rpc; in evrpc_reqstate_free()
389 if (rpc_state->hook_meta != NULL) in evrpc_reqstate_free()
390 evrpc_hook_context_free(rpc_state->hook_meta); in evrpc_reqstate_free()
391 if (rpc_state->request != NULL) in evrpc_reqstate_free()
392 rpc->request_free(rpc_state->request); in evrpc_reqstate_free()
393 if (rpc_state->reply != NULL) in evrpc_reqstate_free()
394 rpc->reply_free(rpc_state->reply); in evrpc_reqstate_free()
395 if (rpc_state->rpc_data != NULL) in evrpc_reqstate_free()
396 evbuffer_free(rpc_state->rpc_data); in evrpc_reqstate_free()
397 mm_free(rpc_state); in evrpc_reqstate_free()
404 evrpc_request_done(struct evrpc_req_generic *rpc_state) in evrpc_request_done() argument
409 EVUTIL_ASSERT(rpc_state); in evrpc_request_done()
411 req = rpc_state->http_req; in evrpc_request_done()
412 rpc = rpc_state->rpc; in evrpc_request_done()
414 if (rpc->reply_complete(rpc_state->reply) == -1) { in evrpc_request_done()
419 if ((rpc_state->rpc_data = evbuffer_new()) == NULL) { in evrpc_request_done()
425 rpc->reply_marshal(rpc_state->rpc_data, rpc_state->reply); in evrpc_request_done()
430 evrpc_hook_associate_meta(&rpc_state->hook_meta, req->evcon); in evrpc_request_done()
434 rpc_state, req, rpc_state->rpc_data); in evrpc_request_done()
439 if (evrpc_pause_request(rpc->base, rpc_state, in evrpc_request_done()
452 evrpc_request_done_closure(rpc_state, EVRPC_CONTINUE); in evrpc_request_done()
456 if (rpc_state != NULL) in evrpc_request_done()
457 evrpc_reqstate_free(rpc_state); in evrpc_request_done()
477 struct evrpc_req_generic *rpc_state = arg; in evrpc_request_done_closure() local
479 EVUTIL_ASSERT(rpc_state); in evrpc_request_done_closure()
480 req = rpc_state->http_req; in evrpc_request_done_closure()
490 evhttp_send_reply(req, HTTP_OK, "OK", rpc_state->rpc_data); in evrpc_request_done_closure()
492 evrpc_reqstate_free(rpc_state); in evrpc_request_done_closure()
497 if (rpc_state != NULL) in evrpc_request_done_closure()
498 evrpc_reqstate_free(rpc_state); in evrpc_request_done_closure()