[complement-svn] SF.net SVN: complement: [1719] trunk/complement/explore
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2007-09-01 05:46:37
|
Revision: 1719 http://complement.svn.sourceforge.net/complement/?rev=1719&view=rev Author: complement Date: 2007-08-31 22:46:34 -0700 (Fri, 31 Aug 2007) Log Message: ----------- add search by sockaddr_in in connections container; this useful for non-streamed connections, like UDP Modified Paths: -------------- trunk/complement/explore/include/sockios/sockmgr.h trunk/complement/explore/lib/sockios/ChangeLog Modified: trunk/complement/explore/include/sockios/sockmgr.h =================================================================== --- trunk/complement/explore/include/sockios/sockmgr.h 2007-09-01 05:45:11 UTC (rev 1718) +++ trunk/complement/explore/include/sockios/sockmgr.h 2007-09-01 05:46:34 UTC (rev 1719) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/07/11 20:57:31 ptr> +// -*- C++ -*- Time-stamp: <07/08/31 09:55:36 ptr> /* * Copyright (c) 1997-1999, 2002, 2003, 2005-2007 @@ -239,8 +239,8 @@ ~_Connect() { if ( _proc ) { s.close(); _proc->close(); } delete _proc; } - void open( sock_base::socket_type st, const sockaddr& addr ) - { s.open( st, addr ); _proc = new Connect( s ); } + void open( sock_base::socket_type st, const sockaddr& addr, sock_base::stype t = sock_base::sock_stream ) + { s.open( st, addr, t ); _proc = new Connect( s ); } sockstream s; Connect *_proc; @@ -262,6 +262,13 @@ { return __x.s.rdbuf()->fd() == __y; } }; + struct iaddr_equal : + public std::binary_function<_Connect,sockaddr,bool> + { + bool operator()(const _Connect& __x, const sockaddr& __y) const + { return memcmp( &(__x.s.rdbuf()->inet_sockaddr()), reinterpret_cast<const sockaddr_in *>(&__y), sizeof(sockaddr_in) ) == 0; } + }; + struct pfd_equal : public std::binary_function<typename _fd_sequence::value_type,int,bool> { @@ -287,6 +294,7 @@ protected: typedef sockmgr_stream_MP<Connect> _Self_type; typedef fd_equal _Compare; + typedef iaddr_equal _Compare_inet; typedef typename _Sequence::value_type value_type; typedef typename _Sequence::size_type size_type; typedef _Sequence container_type; @@ -296,6 +304,7 @@ _Sequence _M_c; _Compare _M_comp; + _Compare_inet _M_comp_inet; pfd_equal _pfdcomp; xmt::mutex _c_lock; Modified: trunk/complement/explore/lib/sockios/ChangeLog =================================================================== --- trunk/complement/explore/lib/sockios/ChangeLog 2007-09-01 05:45:11 UTC (rev 1718) +++ trunk/complement/explore/lib/sockios/ChangeLog 2007-09-01 05:46:34 UTC (rev 1719) @@ -6,6 +6,9 @@ * sockstream.cc: clean; replace sleep by yield in recvfrom, but function not really in use now; + * sockmgr.h: add search by sockaddr_in in connections container; + this useful for non-streamed connections, like UDP. + 2007-08-23 Petr Ovtchenkov <pt...@is...> * sockmgr.h: explicitly inhibit copy of basic_sockmgr and This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |