1
0
Fork 0
mirror of https://github.com/KingDuckZ/incredis synced 2024-11-27 00:43:50 +00:00

Bugfix - command pointer became wrong when IncRedis got moved.

This commit is contained in:
King_DuckZ 2017-06-20 21:26:14 +01:00
parent a9de3643f4
commit 0aee978661
3 changed files with 12 additions and 2 deletions

View file

@ -39,13 +39,14 @@ namespace redis {
explicit ScriptManager ( Command* parCommand ); explicit ScriptManager ( Command* parCommand );
boost::string_view submit_lua_script ( const std::string& parScript ); boost::string_view submit_lua_script ( const std::string& parScript );
void update_command_ptr (Command* parNewPtr);
private: private:
using Sha1Array = std::array<char, 40>; using Sha1Array = std::array<char, 40>;
boost::string_view add_lua_script_ifn ( const std::string& parScript ); boost::string_view add_lua_script_ifn ( const std::string& parScript );
Command* const m_command; Command* m_command;
#if defined(MAKE_SHA1_WITH_CRYPTOPP) #if defined(MAKE_SHA1_WITH_CRYPTOPP)
std::set<Sha1Array> m_known_hashes; std::set<Sha1Array> m_known_hashes;
#else #else

View file

@ -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::Command (std::string&& parSocket) :
Command(std::move(parSocket), 0) Command(std::move(parSocket), 0)

View file

@ -108,4 +108,9 @@ namespace redis {
return boost::string_view(it_inserted->second.data(), it_inserted->second.size()); return boost::string_view(it_inserted->second.data(), it_inserted->second.size());
} }
#endif #endif
void ScriptManager::update_command_ptr (Command* parNewPtr) {
assert(parNewPtr);
m_command = parNewPtr;
}
} //namespace redis } //namespace redis