This is called within ServeEpollST or ServeEpollMT in the event of an epoll error being detected. The origin of the epoll error would be such as connection reset by peer, or a broken pipe. The remedial action is to remove any remaining outgoing data as this has no chance of being delivered to the client. However the socket itself is not closed immeadiately. This is left open for a limited period so that it is not assigned to another connection. Arguments: None Returns: None

Return TypeFunction nameArguments
voidhzIpConnex::Terminate(void)

Declared in file: hzIpServer.h
Defined in file : hzIpServer.cpp

Function Logic:

0:START 1:items m_nExpected 2:unknown 3:items 4:unknown 5:items 6:unknown 7:items 8:unknown 9:items 10:items 11:m_nSock 12: No text

Function body:

void hzIpConnex::Terminate (void)
{
   //  This is called within ServeEpollST or ServeEpollMT in the event of an epoll error being detected. The origin of the epoll error would be such
   //  as connection reset by peer, or a broken pipe.
   //  
   //  The remedial action is to remove any remaining outgoing data as this has no chance of being delivered to the client. However the socket itself
   //  is not closed immeadiately. This is left open for a limited period so that it is not assigned to another connection.
   //  
   //  Arguments: None
   //  Returns: None
   _hzfunc("hzIpConnex::Terminate") ;
   struct epoll_event  epEv ;      //  Epoll event for depricated connection
   hzXDate             now ;       //  Time now
   m_Input.Clear() ;
   m_nExpected = 0;
   if (m_Outgoing.Size())
       m_Outgoing.Clear() ;
   if (!m_nSock)
       m_pLog->Log("No socket - Has Terminate already been called?\n") ;
   else
   {
       if (epoll_ctl(s_pTheOneAndOnlyServer->s_epollSocket, EPOLL_CTL_DEL, m_nSock, &epEv) < 0)
           m_pLog->Log("EPOLL ERROR: Could not del client connection handler on sock %d/%d. Error=%s\n", m_nSock, m_nPort, strerror(errno)) ;
       if (close(m_nSock) < 0)
           m_pLog->Log("Could not close socket %d for event %d on IP %s. Errno=%s", m_nSock, m_nMsgno, *m_ClientIP, strerror(errno)) ;
       else
           m_pLog->Log("Socket %d closed\n", m_nSock) ;
       m_nSock = 0;
   }
   /*
   **  if (m_Track.Size())
   **   {
   **    now.SysDateTime() ;
   **  
   **    m_pLog->Out("SESSION TRACE: Terminated at %s\n[\n", now.Txt(FMT_TIME_USEC)) ;
   **    m_pLog->Out(m_Track) ;
   **    m_pLog->Out("TRACE END:\n]\n\n") ;
   **   }
   **      */
}