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

Method rpc_run

lib_acl_cpp/samples/master/master_http_rpc/http_rpc.cpp:24–54  ·  view source on GitHub ↗

���� service_.rpc_fork ���� RPC ��������߳��е��ñ����� ��������������ģ�鷢����������Ϣ

Source from the content-addressed store, hash-verified

22// ���� service_.rpc_fork ���� RPC ��������߳��е��ñ�����
23// ��������������ģ�鷢����������Ϣ
24void http_rpc::rpc_run()
25{
26 // ������������
27 acl::socket_stream stream;
28
29 // ������ get_vstream() ��õ� ACL_VSTREAM ������������
30 // ���� stream ������Ϊ�� acl_cpp �� acl �е�������
31 // �ͷ����������ն��ǻ��� ACL_VSTREAM���� ACL_VSTREAM ��
32 // �ڲ�ά������һ����/д�������������ڳ����ӵ����ݴ����У�
33 // ����ÿ�ν� ACL_VSTREAM ��Ϊ�ڲ����Ļ��������Դ�
34 ACL_VSTREAM* vstream = client_->get_vstream();
35 ACL_VSTREAM_SET_RWTIMO(vstream, 10);
36 (void) stream.open(vstream);
37 // ����Ϊ����ģʽ
38 stream.set_tcp_non_blocking(false);
39
40 rpc_req_add();
41
42 // ��ʼ������ HTTP ����
43 handle_conn(&stream);
44
45 rpc_req_del();
46
47 // ����Ϊ������ģʽ
48 stream.set_tcp_non_blocking(true);
49
50 // �� ACL_VSTREAM �������������󶨣��������ܱ�֤���ͷ�����������ʱ
51 // ����ر��������ߵ����ӣ���Ϊ�����ӱ��������ڷ�����������ģ���Ҫ��
52 // ���첽���رշ�ʽ���йر�
53 stream.unbind();
54}
55
56void http_rpc::handle_conn(acl::socket_stream* stream)
57{

Callers

nothing calls this directly

Calls 5

rpc_req_addFunction · 0.70
rpc_req_delFunction · 0.70
get_vstreamMethod · 0.45
openMethod · 0.45
unbindMethod · 0.45

Tested by

no test coverage detected