[complement-svn] SF.net SVN: complement: [1839] branches/complement-sockios/explore
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2008-04-01 14:45:04
|
Revision: 1839 http://complement.svn.sourceforge.net/complement/?rev=1839&view=rev Author: complement Date: 2008-04-01 07:44:59 -0700 (Tue, 01 Apr 2008) Log Message: ----------- under debugging Modified Paths: -------------- branches/complement-sockios/explore/include/sockios/sp.h branches/complement-sockios/explore/lib/sockios/ut/Makefile Modified: branches/complement-sockios/explore/include/sockios/sp.h =================================================================== --- branches/complement-sockios/explore/include/sockios/sp.h 2008-03-28 21:09:36 UTC (rev 1838) +++ branches/complement-sockios/explore/include/sockios/sp.h 2008-04-01 14:44:59 UTC (rev 1839) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <08/03/27 17:53:40 yeti> +// -*- C++ -*- Time-stamp: <08/04/01 18:40:57 yeti> /* * Copyright (c) 2008 @@ -189,6 +189,7 @@ if ( !basic_socket_t::is_open_unsafe() ) { return; } + basic_socket<charT,traits,_Alloc>::mgr->pop( dynamic_cast<sock_processor_base<charT,traits,_Alloc>&>(*this), basic_socket_t::_fd ); #ifdef WIN32 ::closesocket( basic_socket_t::_fd ); #else @@ -632,7 +633,8 @@ socks_processor_t *p; }; - struct ctl { + struct ctl + { int cmd; union { int fd; @@ -677,6 +679,7 @@ if ( _worker->joinable() ) { ctl _ctl; _ctl.cmd = rqstop; + _ctl.data.ptr = 0; ::write( pipefd[1], &_ctl, sizeof(ctl) ); @@ -724,6 +727,13 @@ } } + void pop( socks_processor_t& p, int _fd ) + { + fd_info info = { fd_info::listener, 0, &p }; + std::tr2::lock_guard<std::tr2::mutex> lk( cll ); + closed_queue[_fd] = info; + } + void exit_notify( sockbuf_t* b, int fd ) { fd_info info = { 0, reinterpret_cast<sockstream_t*>(b), 0 }; @@ -904,7 +914,16 @@ // throw system_error } std::cerr << "adopt_new_t()\n"; - (*info.p)( *s, typename socks_processor_t::adopt_new_t() ); + std::tr2::lock_guard<std::tr2::mutex> lk( cll ); + typename fd_container_type::iterator closed_ifd = closed_queue.begin(); + for ( ; closed_ifd != closed_queue.end(); ++closed_ifd ) { + if ( closed_ifd->second.p == info.p ) { + break; + } + } + if ( closed_ifd == closed_queue.end() ) { + (*info.p)( *s, typename socks_processor_t::adopt_new_t() ); + } } else { std::cerr << "Accept, delete " << fd << std::endl; delete s; @@ -957,7 +976,16 @@ } std::cerr << "Z " << ev[i].data.fd << ", " << errno << std::endl; if ( info.p != 0 ) { - (*info.p)( *info.s.s, typename socks_processor_t::adopt_data_t() ); + std::tr2::lock_guard<std::tr2::mutex> lk( cll ); + typename fd_container_type::iterator closed_ifd = closed_queue.begin(); + for ( ; closed_ifd != closed_queue.end(); ++closed_ifd ) { + if ( closed_ifd->second.p == info.p ) { + break; + } + } + if ( closed_ifd == closed_queue.end() ) { + (*info.p)( *info.s.s, typename socks_processor_t::adopt_data_t() ); + } } break; } @@ -1004,7 +1032,16 @@ b->ucnd.notify_one(); if ( info.p != 0 ) { // std::cerr << "data here" << std::endl; - (*info.p)( *info.s.s, typename socks_processor_t::adopt_data_t() ); + std::tr2::lock_guard<std::tr2::mutex> lk( cll ); + typename fd_container_type::iterator closed_ifd = closed_queue.begin(); + for ( ; closed_ifd != closed_queue.end(); ++closed_ifd ) { + if ( closed_ifd->second.p == info.p ) { + break; + } + } + if ( closed_ifd == closed_queue.end() ) { + (*info.p)( *info.s.s, typename socks_processor_t::adopt_data_t() ); + } } } else { std::cerr << "K " << ev[i].data.fd << ", " << errno << std::endl; @@ -1022,7 +1059,16 @@ // throw system_error } if ( info.p != 0 ) { - (*info.p)( *info.s.s, typename socks_processor_t::adopt_close_t() ); + std::tr2::lock_guard<std::tr2::mutex> lk( cll ); + typename fd_container_type::iterator closed_ifd = closed_queue.begin(); + for ( ; closed_ifd != closed_queue.end(); ++closed_ifd ) { + if ( closed_ifd->second.p == info.p ) { + break; + } + } + if ( closed_ifd == closed_queue.end() ) { + (*info.p)( *info.s.s, typename socks_processor_t::adopt_close_t() ); + } } if ( (info.flags & fd_info::owner) != 0 ) { delete info.s.s; Modified: branches/complement-sockios/explore/lib/sockios/ut/Makefile =================================================================== --- branches/complement-sockios/explore/lib/sockios/ut/Makefile 2008-03-28 21:09:36 UTC (rev 1838) +++ branches/complement-sockios/explore/lib/sockios/ut/Makefile 2008-04-01 14:44:59 UTC (rev 1839) @@ -23,8 +23,6 @@ stldbg-shared: LDSEARCH += -L${LIBMT_DIR}/${OUTPUT_DIR_STLDBG} -L${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG} -L${LIBSOCK_DIR}/${OUTPUT_DIR_STLDBG} -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_STLDBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_STLDBG}:${LIBSOCK_DIR}/${OUTPUT_DIR_STLDBG}:${STLPORT_LIB_DIR} endif dbg-shared: LDSEARCH += -L${LIBMT_DIR}/${OUTPUT_DIR_DBG} -L${LIBEXAM_DIR}/${OUTPUT_DIR_DBG} -L${LIBSOCK_DIR}/${OUTPUT_DIR_DBG} -Wl,--rpath=${LIBMT_DIR}/${OUTPUT_DIR_DBG}:${LIBEXAM_DIR}/${OUTPUT_DIR_DBG}:${LIBSOCK_DIR}/${OUTPUT_DIR_DBG}:${STLPORT_LIB_DIR} - -dbg-shared: CXXFLAGS += -fkeep-inline-functions endif release-shared : LDLIBS = -lxmt -lsockios -lexam This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |