本文整理汇总了C++中Channel::OnChildClose方法的典型用法代码示例。如果您正苦于以下问题:C++ Channel::OnChildClose方法的具体用法?C++ Channel::OnChildClose怎么用?C++ Channel::OnChildClose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::OnChildClose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoClose
bool Channel::DoClose(bool inDestructor)
{
bool hasfd = false;
//DEBUG_LOG("Before close channel, read fd:%d, write fd:%d for channel[%u]", GetReadFD(), GetWriteFD(), GetID());
int read_fd = GetReadFD();
int write_fd = GetWriteFD();
//int mask = AE_READABLE | AE_WRITABLE;
if (read_fd > 0)
{
aeDeleteFileEvent(GetService().GetRawEventLoop(), read_fd,
AE_READABLE | AE_WRITABLE);
hasfd = true;
}
if (read_fd != write_fd && write_fd > 0)
{
aeDeleteFileEvent(GetService().GetRawEventLoop(), write_fd,
AE_WRITABLE);
hasfd = true;
}
CancelFlushTimerTask();
if (NULL != m_file_sending)
{
close(m_file_sending->fd);
m_file_sending->fd = -1;
if (NULL != m_file_sending->on_failure)
{
m_file_sending->on_failure(m_file_sending->data);
}
}
bool ret = false;
if (hasfd && DoClose() && !inDestructor)
{
ret = fire_channel_closed(this);
if (0 != m_parent_id)
{
Channel* parent = GetService().GetChannel(m_parent_id);
if (NULL != parent)
{
parent->OnChildClose(this);
}
}
}
DELETE(m_file_sending);
if (!m_has_removed && !inDestructor)
{
m_has_removed = true;
GetService().RemoveChannel(this);
}
return ret;
}