From 671b38d87d915e01827ce6e6d3ad9d9d0ed92497 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 15 Jan 2004 20:03:23 +0000 Subject: [PATCH] *** empty log message *** --- src/session.cpp | 76 ++++++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/src/session.cpp b/src/session.cpp index 502bb5c3a..0a619ccdc 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -460,6 +460,46 @@ namespace libtorrent break; } +#ifndef NDEBUG + assert_invariant(); +#endif + + // ************************ + // SEND SOCKETS + // ************************ + + // let the writable clients send data + for (std::vector >::iterator i + = writable_clients.begin(); + i != writable_clients.end(); + ++i) + { + assert((*i)->is_writable()); + connection_map::iterator p = m_connections.find(*i); + // the connection may have been disconnected in the receive phase + if (p == m_connections.end()) + { + m_selector.remove(*i); + } + else + { + try + { + assert(m_selector.is_writability_monitored(p->first)); + assert(p->second->has_data()); + assert(p->second->get_socket()->is_writable()); + p->second->send_data(); + } + catch(std::exception&) + { + // the connection wants to disconnect for some reason, remove it + // from the connection-list + m_selector.remove(*i); + m_connections.erase(p); + } + } + } + #ifndef NDEBUG assert_invariant(); #endif @@ -531,42 +571,6 @@ namespace libtorrent assert_invariant(); #endif - // ************************ - // SEND SOCKETS - // ************************ - - // let the writable clients send data - for (std::vector >::iterator i - = writable_clients.begin(); - i != writable_clients.end(); - ++i) - { - assert((*i)->is_writable()); - connection_map::iterator p = m_connections.find(*i); - // the connection may have been disconnected in the receive phase - if (p == m_connections.end()) - { - m_selector.remove(*i); - } - else - { - try - { - assert(m_selector.is_writability_monitored(p->first)); - assert(p->second->has_data()); - assert(p->second->get_socket()->is_writable()); - p->second->send_data(); - } - catch(std::exception&) - { - // the connection wants to disconnect for some reason, remove it - // from the connection-list - m_selector.remove(*i); - m_connections.erase(p); - } - } - } - // ************************ // ERROR SOCKETS // ************************