Changeset 605

Show
Ignore:
Timestamp:
08/08/06 01:13:31 (2 years ago)
Author:
common
Message:

nepenthes

  • nepenthes core
    • SocketManager::removePOLLSocket(POLLSocket *sock) added
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nepenthes/trunk/nepenthes-core/include/SocketManager.hpp

    r500 r605  
    6868 
    6969                virtual Socket *addPOLLSocket(POLLSocket *sock); 
     70                virtual bool removePOLLSocket(POLLSocket *sock); 
    7071 
    7172                bool doLoop(uint32_t polltimeout); 
  • nepenthes/trunk/nepenthes-core/src/SocketManager.cpp

    r550 r605  
    229229                { 
    230230                        // socket is dead 
    231                         logSpam("Socket %s is Dead\n",(*itSocket)->getDescription().c_str()); 
     231                        logSpam("Socket %i %s is Dead\n",(*itSocket)->getSocket(), (*itSocket)->getDescription().c_str()); 
    232232                        (*itSocket)->unsetPolled(); 
    233233 
     
    597597} 
    598598 
    599  
     599bool SocketManager::removePOLLSocket(POLLSocket *sock) 
     600
     601        logPF(); 
     602        list <Socket *>::iterator it; 
     603        for ( it = m_Sockets.begin();it != m_Sockets.end(); it++ ) 
     604        { 
     605                if (sock == (*it)) 
     606                { 
     607                        /* this is really *bad* 
     608                         * as it may change the order of pollfd's 
     609                         * we should replace the socket to remove with a dead dummy socket who shares the same poll flags instead, and  
     610                         * let the poll loop remove the socket instead 
     611                         * but this works for now, and does not make any problem, so ... 
     612                         */ 
     613                        m_Sockets.erase(it); 
     614                        return true; 
     615                } 
     616        } 
     617        return false; 
     618
     619