Example #1
0
// Close the connection, but not until we've written the buffered outgoing data first
// Takes the reason we're closing the connection, or 0 by default
void CNeighbour::DelayClose(UINT nError)
{
	// If this method got passed a close reason error, report it
	if ( nError ) theApp.Message( MSG_ERROR, nError, (LPCTSTR)m_sAddress );

	// Change this object's state to closing
	m_nState = nrsClosing;

	// Have the connection object write all the outgoing data soon
	QueueRun();
}
Example #2
0
BOOL CDCNeighbour::Send(CPacket* pPacket, BOOL bRelease, BOOL /*bBuffered*/)
{
	m_nOutputCount++;

	if ( m_pZOutput )
		pPacket->ToBuffer( m_pZOutput );
	else
		Write( pPacket );

	QueueRun();

	pPacket->SmartDump( &m_pHost, FALSE, TRUE, (DWORD_PTR)this );

	if ( bRelease ) pPacket->Release();

	return TRUE;
}
Example #3
0
// Close the connection, but not until we've written the buffered outgoing data first
// Takes the reason we're closing the connection, or 0 by default
void CConnection::DelayClose(UINT nError)
{
	ASSERT( nError );

	// Clear input buffer
	{
		CQuickLock oInputLock( *m_pInputSection );
		m_pInput->Clear();
	}

	// Disable incoming data
	shutdown( m_hSocket, SD_RECEIVE );

	// Prolong ban (if any) for incoming connection
	if ( ! m_bInitiated )
		Security.Complain( &m_pHost.sin_addr );

	m_nDelayCloseReason = nError;

	// Have the connection object write all the outgoing data soon
	QueueRun();
}