[complement-svn] SF.net SVN: complement: [1501] trunk/complement/explore
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2007-02-01 10:03:29
|
Revision: 1501 http://svn.sourceforge.net/complement/?rev=1501&view=rev Author: complement Date: 2007-02-01 02:03:27 -0800 (Thu, 01 Feb 2007) Log Message: ----------- clean container with sockstreams, to force 'close' call for all connections during server close process; try to block some signals during close Modified Paths: -------------- trunk/complement/explore/include/config/_linux.h trunk/complement/explore/include/sockios/sockmgr.cc trunk/complement/explore/include/sockios/sockmgr.h trunk/complement/explore/lib/sockios/ChangeLog trunk/complement/explore/test/sockios/sockios_test.cc Modified: trunk/complement/explore/include/config/_linux.h =================================================================== --- trunk/complement/explore/include/config/_linux.h 2007-02-01 10:00:21 UTC (rev 1500) +++ trunk/complement/explore/include/config/_linux.h 2007-02-01 10:03:27 UTC (rev 1501) @@ -1,10 +1,12 @@ -/* Time-stamp: <05/12/12 10:47:37 ptr> */ +/* Time-stamp: <07/01/31 23:51:12 ptr> */ /* + * * Copyright (c) 2003-2007 * Petr Ovtchenkov * - * Licensed under the Academic Free License Version 3.0 + * Licensed under the Academic Free License version 3.0 + * */ #ifndef __config__linux_h @@ -17,7 +19,7 @@ /* * Include this first, due to <features.h> unconditionally redefine * a lot of macros. -*/ + */ #include <features.h> @@ -59,9 +61,10 @@ # error "__BYTE_ORDER neither __BIG_ENDIAN nor __LITTLE_ENDIAN; Fix me!" #endif -/* select-based socket manager not supported a long time, and produce errors on x64 - * I turn off usage of select -*/ +/* + * select-based socket manager not maintained a long time, and produce + * errors on x86_64, so I turn off usage of select + */ #define __FIT_NO_SELECT Modified: trunk/complement/explore/include/sockios/sockmgr.cc =================================================================== --- trunk/complement/explore/include/sockios/sockmgr.cc 2007-02-01 10:00:21 UTC (rev 1500) +++ trunk/complement/explore/include/sockios/sockmgr.cc 2007-02-01 10:03:27 UTC (rev 1501) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/01/31 09:43:59 ptr> +// -*- C++ -*- Time-stamp: <07/02/01 10:04:23 ptr> /* * Copyright (c) 1997-1999, 2002, 2003, 2005-2007 @@ -359,10 +359,17 @@ me->mgr.join(); + me->_M_c.clear(); // FIN still may not come yet; forse close + return rtc; // throw; } + xmt::block_signal( SIGINT ); + xmt::block_signal( SIGPIPE ); + xmt::block_signal( SIGCHLD ); + xmt::block_signal( SIGPOLL ); + me->_dlock.lock(); me->_follow = false; me->_pool_cnd.set( true, true ); @@ -377,6 +384,8 @@ me->mgr.join(); + me->_M_c.clear(); // FIN still may not come yet; forse close + return rtc; } @@ -456,6 +465,7 @@ } catch ( ... ) { } + return rtc; } Modified: trunk/complement/explore/include/sockios/sockmgr.h =================================================================== --- trunk/complement/explore/include/sockios/sockmgr.h 2007-02-01 10:00:21 UTC (rev 1500) +++ trunk/complement/explore/include/sockios/sockmgr.h 2007-02-01 10:03:27 UTC (rev 1501) @@ -1,7 +1,7 @@ -// -*- C++ -*- Time-stamp: <07/01/31 08:55:49 ptr> +// -*- C++ -*- Time-stamp: <07/01/31 23:52:05 ptr> /* - * Copyright (c) 1997-1999, 2002, 2003, 2005, 2006 + * Copyright (c) 1997-1999, 2002, 2003, 2005-2007 * Petr Ovtchenkov * * Portion Copyright (c) 1999-2001 Modified: trunk/complement/explore/lib/sockios/ChangeLog =================================================================== --- trunk/complement/explore/lib/sockios/ChangeLog 2007-02-01 10:00:21 UTC (rev 1500) +++ trunk/complement/explore/lib/sockios/ChangeLog 2007-02-01 10:03:27 UTC (rev 1501) @@ -1,3 +1,11 @@ +2007-02-01 Petr Ovtchenkov <pt...@is...> + + * sockmgr.cc: clean container with sockstreams, + to force 'close' call for all connections during server + close process; try to block some signals during close. + + * libsockios: Version 1.10.3 + 2007-01-31 Petr Ovtchenkov <pt...@is...> * sockmgr.h, sockmgr.cc: really erase iterators @@ -2,3 +10,3 @@ from _conn_pool; remove sockstream from processing, - if it was closed during 'connect' processing. + if it was closed during 'connect' processing; Modified: trunk/complement/explore/test/sockios/sockios_test.cc =================================================================== --- trunk/complement/explore/test/sockios/sockios_test.cc 2007-02-01 10:00:21 UTC (rev 1500) +++ trunk/complement/explore/test/sockios/sockios_test.cc 2007-02-01 10:03:27 UTC (rev 1501) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/01/31 10:55:45 ptr> +// -*- C++ -*- Time-stamp: <07/01/31 23:47:57 ptr> /* * @@ -141,7 +141,7 @@ { public: Cnt( sockstream& ) - { xmt::Locker lk(lock); ++cnt; } + { xmt::Locker lk(lock); ++cnt; ++visits; } ~Cnt() { xmt::Locker lk(lock); --cnt; } @@ -152,19 +152,22 @@ void close() { } + static int get_visits() + { xmt::Locker lk(lock); return visits; } + static xmt::Mutex lock; static int cnt; + static int visits; }; xmt::Mutex Cnt::lock; int Cnt::cnt = 0; +int Cnt::visits = 0; void sockios_test::ctor_dtor() { - // Check, that naumber of ctors of Cnt is the same as number of called dtors - // i.e. all created Cnt freed. - // due to async nature of communication, no way to check Cnt::cnt - // before server stop. + // Check, that number of ctors of Cnt is the same as number of called dtors + // i.e. all created Cnt was released. { sockmgr_stream_MP<Cnt> srv( port ); @@ -178,6 +181,12 @@ BOOST_CHECK( s1.good() ); BOOST_CHECK( s1.is_open() ); + while ( Cnt::get_visits() == 0 ) { + xmt::delay( xmt::timespec(0,10000) ); + } + Cnt::lock.lock(); + BOOST_CHECK( Cnt::cnt == 1 ); + Cnt::lock.unlock(); } srv.close(); @@ -185,9 +194,14 @@ Cnt::lock.lock(); BOOST_CHECK( Cnt::cnt == 0 ); + Cnt::visits = 0; Cnt::lock.unlock(); - } + + Cnt::lock.lock(); + BOOST_CHECK( Cnt::cnt == 0 ); + Cnt::lock.unlock(); + { sockmgr_stream_MP<Cnt> srv( port ); @@ -207,6 +221,12 @@ BOOST_CHECK( s1.is_open() ); BOOST_CHECK( s2.good() ); BOOST_CHECK( s2.is_open() ); + while ( Cnt::get_visits() < 2 ) { + xmt::delay( xmt::timespec(0,10000) ); + } + Cnt::lock.lock(); + BOOST_CHECK( Cnt::cnt == 2 ); + Cnt::lock.unlock(); } srv.close(); @@ -215,8 +235,11 @@ Cnt::lock.lock(); BOOST_CHECK( Cnt::cnt == 0 ); Cnt::lock.unlock(); - } + + Cnt::lock.lock(); + BOOST_CHECK( Cnt::cnt == 0 ); + Cnt::lock.unlock(); } class loader This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |