| 65 | } |
| 66 | |
| 67 | static 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 | |
| 112 | void master_warning(const char *notify_addr, const char *recipients, |
| 113 | const char *path, const char *conf, const char *ver, |
nothing calls this directly
no test coverage detected
searching dependent graphs…