MCPcopy Create free account
hub / github.com/acl-dev/acl / http_ipc

Class http_ipc

lib_acl_cpp/src/http/http_service.cpp:490–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488//////////////////////////////////////////////////////////////////////////
489
490class http_ipc : public ipc_client
491{
492public:
493 http_ipc(acl_int64 magic) : ipc_client(magic) {}
494
495 ~http_ipc(void) {}
496
497 // @override
498 void on_message(int nMsg, void* data, int dlen)
499 {
500 if (dlen != sizeof(HTTP_IPC_DAT)) {
501 abort();
502 }
503 HTTP_IPC_DAT* dat = (HTTP_IPC_DAT*) data;
504
505 switch (nMsg) {
506 case HTTP_MSG_HDR:
507 dat->callback->on_hdr(dat->i_addr, dat->i_hdr_res);
508 break;
509 case HTTP_MSG_DAT:
510 dat->callback->on_body(dat->i_ptr, dat->i_dlen);
511 if (dat->i_ptr && dat->i_dlen > 0) {
512 acl_myfree(dat->i_ptr);
513 } else {
514 // ���������������ٹ���
515 dat->callback->destroy();
516 if (dat->i_hdr_res) {
517 http_hdr_res_free(dat->i_hdr_res);
518 }
519 this->close(); // �Զ�������������
520 }
521 break;
522 case HTTP_MSG_ERR:
523 dat->callback->on_error(dat->i_error);
524 // ���������������ٹ���
525 dat->callback->destroy();
526 if (dat->i_hdr_res) {
527 http_hdr_res_free(dat->i_hdr_res);
528 }
529 this->close(); // �Զ�������������
530 break;
531 default:
532 // �������쳣��Ϣ
533 logger_error("unknown ipc msg: %d", nMsg);
534 break;
535 }
536 }
537
538protected:
539 // @override
540 void on_close(void)
541 {
542 delete this;
543 }
544private:
545 //HTTP_HDR_RES* hdr_res_;
546};
547

Callers 1

on_acceptMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…