From dff6b72aced39e78ddfdfd2e38993e0c5cfbcbb7 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Sun, 3 Feb 2013 21:11:08 -0500 Subject: [PATCH] various bug fixes --- include/fc/json_rpc_client.hpp | 2 +- include/fc/signal.hpp | 32 +++++++++++++++++++++++++++++--- include/fc/ssh/client.hpp | 7 +++++++ include/fc/ssh/process.hpp | 2 ++ 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/include/fc/json_rpc_client.hpp b/include/fc/json_rpc_client.hpp index fd286fa..88bc081 100644 --- a/include/fc/json_rpc_client.hpp +++ b/include/fc/json_rpc_client.hpp @@ -65,7 +65,7 @@ namespace fc { namespace json { this->_vtable.reset(new fc::detail::vtable() ); this->_vtable->template visit_other( fc::json::detail::vtable_visitor(_con) ); } - const rpc_connection& connection()const { return _con; } + const rpc_connection::ptr& connection()const { return _con; } private: rpc_connection::ptr _con; diff --git a/include/fc/signal.hpp b/include/fc/signal.hpp index 925ef4f..b2ed9ee 100644 --- a/include/fc/signal.hpp +++ b/include/fc/signal.hpp @@ -16,19 +16,45 @@ namespace fc { _handlers.push_back( c ); return reinterpret_cast(c); } - +#ifdef WIN32 + template + void emit( Arg&& arg ) { + for( size_t i = 0; i < _handlers.size(); ++i ) { + (*_handlers[i])( fc::forward(arg) ); + } + } + template + void operator()( Arg&& arg ) { + for( size_t i = 0; i < _handlers.size(); ++i ) { + (*_handlers[i])( fc::forward(arg) ); + } + } + template + void emit( Arg&& arg, Arg2&& arg2 ) { + for( size_t i = 0; i < _handlers.size(); ++i ) { + (*_handlers[i])( fc::forward(arg), fc::forward(arg2) ); + } + } + template + void operator()( Arg&& arg, Arg2&& arg2 ) { + for( size_t i = 0; i < _handlers.size(); ++i ) { + (*_handlers[i])( fc::forward(arg), fc::forward(arg2) ); + } + } +#else template void emit( Args&&... args ) { for( size_t i = 0; i < _handlers.size(); ++i ) { - (*_handlers[i])( args... ); + (*_handlers[i])( fc::forward(args)... ); } } template void operator()( Args&&... args ) { for( size_t i = 0; i < _handlers.size(); ++i ) { - (*_handlers[i])( args... ); + (*_handlers[i])( fc::forward(args)... ); } } +#endif void disconnect( connection_id_type cid ) { auto itr = _handlers.begin(); diff --git a/include/fc/ssh/client.hpp b/include/fc/ssh/client.hpp index baf280d..6e1b9ef 100644 --- a/include/fc/ssh/client.hpp +++ b/include/fc/ssh/client.hpp @@ -103,6 +103,13 @@ namespace fc { */ void mkdir( const fc::path& remote_dir, int mode = owner_read|owner_write|owner_exec ); + /** + * Create all parent directories for remote_dir if they do not exist. + * + * @post remote_dir exists. + */ + void create_directories( const fc::path& remote_dir, int mode = owner_read|owner_write|owner_exec ); + void close(); client(); diff --git a/include/fc/ssh/process.hpp b/include/fc/ssh/process.hpp index 42fecfc..8d4c4b8 100644 --- a/include/fc/ssh/process.hpp +++ b/include/fc/ssh/process.hpp @@ -48,6 +48,8 @@ namespace fc { * @brief returns a stream that reads from the process' stderr */ fc::istream& err_stream()const; + + process& operator=( const process& p ); private: friend class client; process( client& c, const fc::string& cmd, const fc::string& pty_type = fc::string() );