您的位置:首页 > 其它

6.9.1.2 qmgr_entry_done:清理活动数据

2016-04-07 15:35 316 查看
qmgr_entry_done该函数首先将QMGR_ENTRY结构体从相关的链表中取下,更新引用计数:

else if (which== QMGR_QUEUE_TODO) {
QMGR_LIST_UNLINK(peer->entry_list,QMGR_ENTRY *, entry, peer_peers);
job->selected_entries++;
QMGR_LIST_UNLINK(queue->todo,QMGR_ENTRY *, entry, queue_peers);
queue->todo_refcount--;
}


一旦所有引用计数更新完毕,销毁QMGR_ENTRY结构体:
/*
* Decrease the in-core recipient counts and free the recipient list and
* the structure itself.
*/
job->rcpt_count -= entry->rcpt_list.len;
message->rcpt_count -= entry->rcpt_list.len;
qmgr_recipient_count -= entry->rcpt_list.len;
recipient_list_free(&entry->rcpt_list);
myfree((void*) entry);


至此延迟信件的todoQMGR_ENTRY结构体被销毁完毕,将没有“活动数据”可以发送信件,但邮件原信依然在active队列中。一旦QMGR_MESSAGE的所有引用计数处理完毕,使用qmgr_active_done函数处理该原信,这里的“done”同样意味着对activ队列中的信件做最后的处理:
/*
*Update the in-core message reference count. When the in-core message
* structure has no more references, dispose of the message.
*/
message->refcount--;
if (message->refcount == 0)
qmgr_active_done(message);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: