[Quickfix-developers] SocketMonitor::drop(): use iterator instead of socket in m_socket s.erase()
Brought to you by:
orenmnero
|
From: John D. <joh...@ch...> - 2005-12-09 23:29:52
|
Hi,
The SocketMonitor::drop function gets passed a socket, looks for it in a
std::set, and, if it's found in the set, erases it. It erases it with the
value of the socket, though, instead of the iterator. This means m_sockets
will be searched again for the socket, even though it's already been found.
Can we just give erase() the iterator we've already retrieved and save
ourselves a redundant search?
It is, admittedly, a very minor change...
--
John
===================================================================
RCS file: /cvsroot/quickfix/quickfix/src/C++/SocketMonitor.cpp,v
retrieving revision 1.8
diff -u -r1.8 SocketMonitor.cpp
--- SocketMonitor.cpp 18 Jun 2005 11:00:52 -0000 1.8
+++ SocketMonitor.cpp 9 Dec 2005 23:20:52 -0000
@@ -76,7 +76,7 @@
if ( i != m_sockets.end() )
{
socket_close( s );
- m_sockets.erase( s );
+ m_sockets.erase( i );
m_dropped.push( s );
return true;
}
|