diff --git a/include/incredis/script_manager.hpp b/include/incredis/script_manager.hpp index 4c9270c..2a098d5 100644 --- a/include/incredis/script_manager.hpp +++ b/include/incredis/script_manager.hpp @@ -39,13 +39,14 @@ namespace redis { explicit ScriptManager ( Command* parCommand ); boost::string_view submit_lua_script ( const std::string& parScript ); + void update_command_ptr (Command* parNewPtr); private: using Sha1Array = std::array; boost::string_view add_lua_script_ifn ( const std::string& parScript ); - Command* const m_command; + Command* m_command; #if defined(MAKE_SHA1_WITH_CRYPTOPP) std::set m_known_hashes; #else diff --git a/src/command.cpp b/src/command.cpp index 53b35bd..37293c0 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -48,7 +48,11 @@ namespace redis { { } - Command::Command (Command&&) = default; + Command::Command (Command&& parOther) : + m_local_data(std::move(parOther.m_local_data)) + { + m_local_data->lua_scripts.update_command_ptr(this); + } Command::Command (std::string&& parSocket) : Command(std::move(parSocket), 0) diff --git a/src/script_manager.cpp b/src/script_manager.cpp index 45c7ef8..763dee3 100644 --- a/src/script_manager.cpp +++ b/src/script_manager.cpp @@ -108,4 +108,9 @@ namespace redis { return boost::string_view(it_inserted->second.data(), it_inserted->second.size()); } #endif + + void ScriptManager::update_command_ptr (Command* parNewPtr) { + assert(parNewPtr); + m_command = parNewPtr; + } } //namespace redis