Changeset 475


Ignore:
Timestamp:
06/04/08 13:42:07 (12 years ago)
Author:
Eoin
Message:

Just before making 'event()' -> 'event_log' change.

Location:
branch_0_3_1
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branch_0_3_1/sln/Halite/Halite.vcproj

    r474 r475  
    208208                                FavorSizeOrSpeed="2" 
    209209                                AdditionalIncludeDirectories=""$(SolutionDir)src";"$(SolutionDir)src\WTLx";"$(SolutionDir)lib\libtorrent\include";"$(SolutionDir)lib\libtorrent\zlib";"$(SolutionDir)lib\Asio\include";"$(SolutionDir)lib\OpenSSL\inc";"$(SolutionDir)lib\STLSoft\include"" 
    210                                 PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0500;__USE_W32_SOCKETS;WIN32;_WIN32;_WINDOWS;NDEBUG;TORRENT_USE_BOOST_DATE_TIME;TORRENT_USE_OPENSSL;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0" 
     210                                PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0500;__USE_W32_SOCKETS;WIN32;_WIN32;_WINDOWS;NDEBUG;TORRENT_USE_BOOST_DATE_TIME;TORRENT_USE_OPENSSL;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS" 
    211211                                MinimalRebuild="true" 
    212212                                ExceptionHandling="2" 
  • branch_0_3_1/sln/libtorrent/libtorrent.vcproj

    r459 r475  
    176176                                FavorSizeOrSpeed="2" 
    177177                                AdditionalIncludeDirectories=""$(SolutionDir)lib\libtorrent\include";"$(SolutionDir)lib\libtorrent\zlib";"$(SolutionDir)lib\Asio\include\";"$(SolutionDir)lib\Openssl\inc"" 
    178                                 PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0500;__USE_W32_SOCKETS;WIN32;_WIN32;_WINDOWS;NDEBUG;TORRENT_USE_BOOST_DATE_TIME;TORRENT_USE_OPENSSL;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0" 
     178                                PreprocessorDefinitions="WIN32_LEAN_AND_MEAN;_WIN32_WINNT=0x0500;__USE_W32_SOCKETS;WIN32;_WIN32;_WINDOWS;NDEBUG;TORRENT_USE_BOOST_DATE_TIME;TORRENT_USE_OPENSSL;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS" 
    179179                                MinimalRebuild="true" 
    180180                                ExceptionHandling="2" 
  • branch_0_3_1/src/Halite.cpp

    r445 r475  
    5151        void connect()  
    5252        {  
    53                 conn_ = hal::event().attach(bind(&halite_log_file::operator(), this, _1));  
     53                conn_ = hal::event_log.attach(bind(&halite_log_file::operator(), this, _1));  
    5454                assert(conn_.connected()); 
    5555        } 
     
    9292//      hal::event().post(shared_ptr<hal::EventDetail>(new hal::EventDebug(hal::Event::info, L"Hello"))); 
    9393 
    94         ::SetProcessAffinityMask(::GetCurrentProcess(), (DWORD_PTR)0x1); 
     94//      ::SetProcessAffinityMask(::GetCurrentProcess(), (DWORD_PTR)0x1); 
    9595         
    9696        try  
  • branch_0_3_1/src/halEvent.cpp

    r404 r475  
    2626#include <libtorrent/peer_connection.hpp> 
    2727 
     28#define HAL_EVENT_IMPL_UNIT 
    2829#include "halEvent.hpp" 
    2930 
    3031namespace hal 
    3132{ 
     33 
     34static boost::shared_ptr<event_impl> s_event_impl; 
     35 
     36struct event_impl 
     37{ 
     38        mutable mutex_t mutex_; 
     39        boost::signal<void (boost::shared_ptr<EventDetail>)> event_signal_; 
     40}; 
     41 
     42event_logger::event_logger() 
     43{ 
     44        if (!s_event_impl) 
     45                s_event_impl.reset(new event_impl()); 
     46} 
     47 
     48event_logger::~event_logger() 
     49{} 
     50 
     51boost::signals::connection event_logger::attach(boost::function<void (boost::shared_ptr<EventDetail>)> fn) 
     52{ 
     53        mutex_t::scoped_lock l(pimpl_->mutex_); 
     54        return pimpl_->event_signal_.connect(fn); 
     55} 
     56 
     57void event_logger::dettach(const boost::signals::connection& c) 
     58{ 
     59        mutex_t::scoped_lock l(pimpl_->mutex_); 
     60        pimpl_->event_signal_.disconnect(c); 
     61} 
     62 
     63void event_logger::log(boost::shared_ptr<EventDetail> e) 
     64{ 
     65        mutex_t::scoped_lock l(pimpl_->mutex_); 
     66        pimpl_->event_signal_(e); 
     67} 
     68 
     69 
    3270 
    3371void Event::post(boost::shared_ptr<EventDetail> event) 
  • branch_0_3_1/src/halEvent.hpp

    r459 r475  
    4242namespace hal  
    4343{ 
     44 
     45struct event_impl; 
     46 
     47class event_logger : private boost::noncopyable 
     48{        
     49public: 
     50        event_logger(); 
     51        ~event_logger(); 
     52 
     53        bool is_active() { return pimpl_; } 
     54 
     55        boost::signals::connection attach(boost::function<void (boost::shared_ptr<EventDetail>)> fn); 
     56        void dettach(const boost::signals::connection& c); 
     57 
     58        void log(boost::shared_ptr<EventDetail> e); 
     59 
     60private: 
     61        std::vector<boost::signals::scoped_connection> connections_; 
     62        boost::shared_ptr<event_impl> pimpl_; 
     63}; 
     64 
     65#ifndef HAL_EVENT_IMPL_UNIT 
     66static event_logger event_log; 
     67#endif 
    4468 
    4569class Event 
  • branch_0_3_1/src/halTorrent.cpp

    r474 r475  
    250250        std::stable_sort(torrents_.begin(), torrents_.end(), fn); 
    251251} 
    252  
    253252 
    254253web_seed_or_dht_node_detail::web_seed_or_dht_node_detail() :  
Note: See TracChangeset for help on using the changeset viewer.