mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 10:57:34 +08:00
add passwd in redis_pipeline
This commit is contained in:
parent
2481eaa88c
commit
91a9d26c69
@ -81,6 +81,9 @@ public:
|
||||
|
||||
bool start_thread(void);
|
||||
|
||||
public:
|
||||
redis_pipeline_channel& set_passwd(const char* passwd);
|
||||
|
||||
protected:
|
||||
// @override
|
||||
void* run(void);
|
||||
@ -88,6 +91,7 @@ protected:
|
||||
private:
|
||||
string addr_;
|
||||
string buf_;
|
||||
string passwd_;
|
||||
redis_client* conn_;
|
||||
BOX<redis_pipeline_message> box_;
|
||||
std::vector<redis_pipeline_message*> msgs_;
|
||||
|
@ -24,13 +24,22 @@ redis_pipeline_channel::~redis_pipeline_channel(void)
|
||||
delete conn_;
|
||||
}
|
||||
|
||||
redis_pipeline_channel & redis_pipeline_channel::set_passwd(const char *passwd) {
|
||||
if (passwd && *passwd) {
|
||||
passwd_ = passwd;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool redis_pipeline_channel::start_thread(void)
|
||||
{
|
||||
if (!((connect_client*) conn_)->open()) {
|
||||
logger_error("open %s error %s", addr_.c_str(), last_serror());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!passwd_.empty()) {
|
||||
conn_->set_password(passwd_);
|
||||
}
|
||||
this->start();
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user