6.9.2 qmgr_active_done函数:处理已存在的退信文件
2016-04-07 15:36
99 查看
从qmgr_active_done开始的一系列函数继续完成邮件延迟的处理工作:
qmgr_active_done_2_bounce_flush
qmgr_active_done_2_generic
qmgr_active_done_25_generic
qmgr_active_done_25_trace_flush
qmgr_active_done_3_defer_flush
qmgr_active_done_3_defer_warn
qmgr_active_done_3_generic
以上函数是按顺序调用的,但由于实际的工作是交给独立的bounce模块完成的,这些函数没有等待该模块的执行结果直接调用了下面的处理函数,所以它们与bounce模块的执行是“异步”的。
286 如果已经存在退信文件,说明进行过发送退信的操作。
287-290 如果退信文件大小为0,说明退信文件无效,移除该文件。
291-319如果退信文件大小不为0,根据是否存在XVERP命令连接符,也就是根据MAIL命令是否使用了XVERP扩展参数,分别用abounce_flush或abounce_flush_verp函数通过/global/abounce.c使用bounce模块发送退信。我们可以看到参数中的encoding、smtputf8、dsn_envid、dsn_ret等smtp协议扩展参数。
324不存在退信文件的话,继续用qmgr_active_done_2_generic函数进行延迟处理。
qmgr_active_done_2_bounce_flush
qmgr_active_done_2_generic
qmgr_active_done_25_generic
qmgr_active_done_25_trace_flush
qmgr_active_done_3_defer_flush
qmgr_active_done_3_defer_warn
qmgr_active_done_3_generic
以上函数是按顺序调用的,但由于实际的工作是交给独立的bounce模块完成的,这些函数没有等待该模块的执行结果直接调用了下面的处理函数,所以它们与bounce模块的执行是“异步”的。
/qmgr/qmgr_active.c 256 /* qmgr_active_done - dispose ofmessage after recipients have been tried */ 257 258 void qmgr_active_done(QMGR_MESSAGE *message) 259 { 260 const char *myname = "qmgr_active_done"; 261 struct stat st; 262 263 if (msg_verbose) 264 msg_info("%s: %s", myname, message->queue_id); 265 266 /* 267 * During a previous iteration, an attempt to bounce this message may 268 * have failed, so there may still be a bounce log lying around. XXX By 269 * groping around in the bounce queue, we're trespassing on the bounce 270 * service's territory. But doing so is more robust than depending on the 271 * bounce daemon to do the lookup for us, and for us to do the deleting 272 * after we have received a successful status from the bounce service. 273 * The bounce queue directory blocks are most likely in memory anyway. If 274 * these lookups become a performance problem we will have to build an 275 * in-core cache into the bounce daemon. 276 * 277 * Don't bounce when the bounce log is empty. The bounce processobviously 278 * failed, and the delivery agent will have requested that the message be 279 * deferred. 280 * 281 * Bounces are sent asynchronously to avoid stalling while the cleanup 282 * daemon waits for the qmgr to accept the "new mail" trigger. 283 * 284 * See also code in cleanup_bounce.c. 285 */ 286 if (stat(mail_queue_path((VSTRING *) 0, MAIL_QUEUE_BOUNCE,message->queue_id), &st) == 0) {
286 如果已经存在退信文件,说明进行过发送退信的操作。
287 if (st.st_size == 0) { 288 if(mail_queue_remove(MAIL_QUEUE_BOUNCE, message->queue_id)) 289 msg_fatal("remove %s %s:%m", 290 MAIL_QUEUE_BOUNCE,message->queue_id);
287-290 如果退信文件大小为0,说明退信文件无效,移除该文件。
291 } else { 292 if (msg_verbose) 293 msg_info("%s: bounce %s",myname, message->queue_id); 294 if (message->verp_delims == 0|| var_verp_bounce_off) 295 abounce_flush(BOUNCE_FLAG_KEEP, 296 message->queue_name, 297 message->queue_id, 298 message->encoding, 299 message->smtputf8, 300 message->sender, 301 message->dsn_envid, 302 message->dsn_ret, 303 qmgr_active_done_2_bounce_flush, 304 (void *)message); 305 else 306 abounce_flush_verp(BOUNCE_FLAG_KEEP, //类似abounce_flush的参数 315 qmgr_active_done_2_bounce_flush, 317 return; 318 } 319 }
291-319如果退信文件大小不为0,根据是否存在XVERP命令连接符,也就是根据MAIL命令是否使用了XVERP扩展参数,分别用abounce_flush或abounce_flush_verp函数通过/global/abounce.c使用bounce模块发送退信。我们可以看到参数中的encoding、smtputf8、dsn_envid、dsn_ret等smtp协议扩展参数。
320 321 /* 322 * Asynchronous processing does not reach this point. 323 */ 324 qmgr_active_done_2_generic(message); 325 }
324不存在退信文件的话,继续用qmgr_active_done_2_generic函数进行延迟处理。
相关文章推荐
- 1.uniq去重命令讲解
- vsftpd.conf 详解与实例配置
- adgeView使用介绍
- 文件系统及其相关结构体
- 从0开始搭建主流框架(纯代码)
- 周志华老师的《机器学习》课后习题
- 华为OJ-名字的漂亮度
- 6.9.1.2 qmgr_entry_done:清理活动数据
- displacement map置换贴图
- 使用Maven创建Web项目
- Qt基础: 信号和槽
- 存储过程自学
- logstash邮件报警功能实现
- magento 计划任务
- 面试题76:单链表的归并排序
- 菜鸟成长记-打开PDF文件,可以左右滑动
- HashMap内部实现及源码分析
- swift 之actionSheet 使用
- Nyoj 修路方案(次小生成树)
- javasScript正则表达式验证密码(必须含数字字符特殊符号,长度4-16位之间)