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

Function notify_thread

app/master/daemon/master/master_warning.cpp:67–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67static void notify_thread(void *arg)
68{
69 const char *myname = "notify_thread";
70 WARN_INFO *info = (WARN_INFO*) arg;
71 ACL_VSTREAM *client;
72 ACL_VSTRING *buf;
73 int ret;
74
75 buf = acl_vstring_alloc(256);
76 add_str(buf, "path", info->path);
77 add_str(buf, "conf", info->conf);
78 add_str(buf, "ver", info->ver);
79 add_num(buf, "pid", info->pid);
80 add_str(buf, "rcpt", info->notify_recipients);
81 add_str(buf, "info", info->desc);
82 acl_vstring_strcat(buf, "\r\n");
83
84 client = acl_vstream_connect(info->notify_addr,
85 ACL_BLOCKING, 60, 60, 1024);
86 if (client == NULL) {
87 acl_msg_error("%s(%d): connect %s error, info(%s)", myname,
88 __LINE__, info->notify_addr, acl_vstring_str(buf));
89 acl_vstring_free(buf);
90 warn_info_free(info);
91 return;
92 }
93
94 /* ��ֹ���þ�����ݸ��ӽ��� */
95 acl_close_on_exec(ACL_VSTREAM_SOCK(client), ACL_CLOSE_ON_EXEC);
96
97 //acl_msg_info(">>>>Notify=[%s]<<<<<", acl_vstring_str(buf));
98 ret = acl_vstream_writen(client, acl_vstring_str(buf),
99 ACL_VSTRING_LEN(buf));
100 if (ret == ACL_VSTREAM_EOF)
101 acl_msg_error("%s(%d): write to notify server error, info(%s)",
102 myname, __LINE__, acl_vstring_str(buf));
103 else
104 acl_msg_info("%s(%d): notify %s ok!",
105 myname, __LINE__, info->notify_addr);
106
107 acl_vstream_close(client);
108 acl_vstring_free(buf);
109 warn_info_free(info);
110}
111
112void master_warning(const char *notify_addr, const char *recipients,
113 const char *path, const char *conf, const char *ver,

Callers

nothing calls this directly

Calls 12

acl_vstring_allocFunction · 0.85
add_strFunction · 0.85
add_numFunction · 0.85
acl_vstring_strcatFunction · 0.85
acl_vstream_connectFunction · 0.85
acl_msg_errorFunction · 0.85
acl_vstring_freeFunction · 0.85
warn_info_freeFunction · 0.85
acl_close_on_execFunction · 0.85
acl_vstream_writenFunction · 0.85
acl_msg_infoFunction · 0.85
acl_vstream_closeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…