mirror of
https://github.com/sogou/workflow.git
synced 2026-10-29 03:27:04 +08:00
Merge pull request #1467 from sogou/win-dev
Fix kafka compiling problem
This commit is contained in:
@@ -28,8 +28,9 @@
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include "WFTaskError.h"
|
||||
#include "WFKafkaClient.h"
|
||||
#include "StringUtil.h"
|
||||
#include "KafkaTaskImpl.inl"
|
||||
#include "WFKafkaClient.h"
|
||||
|
||||
#define KAFKA_HEARTBEAT_INTERVAL (3 * 1000 * 1000)
|
||||
|
||||
|
||||
@@ -23,10 +23,9 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include "WFTask.h"
|
||||
#include "KafkaMessage.h"
|
||||
#include "KafkaResult.h"
|
||||
#include "KafkaTaskImpl.inl"
|
||||
|
||||
|
||||
class WFKafkaTask;
|
||||
class WFKafkaClient;
|
||||
|
||||
@@ -26,6 +26,31 @@ namespace protocol
|
||||
|
||||
#define MIN(x, y) ((x) <= (y) ? (x) : (y))
|
||||
|
||||
std::string KafkaConfig::get_sasl_info() const
|
||||
{
|
||||
std::string info;
|
||||
if (strcasecmp(this->ptr->mechanisms, "plain") == 0)
|
||||
{
|
||||
info += this->ptr->mechanisms;
|
||||
info += "|";
|
||||
info += this->ptr->username;
|
||||
info += "|";
|
||||
info += this->ptr->password;
|
||||
info += "|";
|
||||
}
|
||||
else if (strncasecmp(this->ptr->mechanisms, "SCRAM", 5) == 0)
|
||||
{
|
||||
info += this->ptr->mechanisms;
|
||||
info += "|";
|
||||
info += this->ptr->username;
|
||||
info += "|";
|
||||
info += this->ptr->password;
|
||||
info += "|";
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
static int compare_member(const void *p1, const void *p2)
|
||||
{
|
||||
kafka_member_t *member1 = (kafka_member_t *)p1;
|
||||
|
||||
@@ -551,30 +551,7 @@ public:
|
||||
return kafka_sasl_set_password(password, this->ptr) == 0;
|
||||
}
|
||||
|
||||
std::string get_sasl_info() const
|
||||
{
|
||||
std::string info;
|
||||
if (strcasecmp(this->ptr->mechanisms, "plain") == 0)
|
||||
{
|
||||
info += this->ptr->mechanisms;
|
||||
info += "|";
|
||||
info += this->ptr->username;
|
||||
info += "|";
|
||||
info += this->ptr->password;
|
||||
info += "|";
|
||||
}
|
||||
else if (strncasecmp(this->ptr->mechanisms, "SCRAM", 5) == 0)
|
||||
{
|
||||
info += this->ptr->mechanisms;
|
||||
info += "|";
|
||||
info += this->ptr->username;
|
||||
info += "|";
|
||||
info += this->ptr->password;
|
||||
info += "|";
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
std::string get_sasl_info() const;
|
||||
|
||||
bool new_client(kafka_sasl_t *sasl)
|
||||
{
|
||||
|
||||
@@ -613,13 +613,13 @@ int kafka_parser_append_message(const void *buf, size_t *size,
|
||||
|
||||
if (s > parser->message_size - parser->cur_size)
|
||||
{
|
||||
memcpy(parser->msgbuf + parser->cur_size, buf,
|
||||
memcpy((char *)parser->msgbuf + parser->cur_size, buf,
|
||||
parser->message_size - parser->cur_size);
|
||||
parser->cur_size = parser->message_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(parser->msgbuf + parser->cur_size, buf, s);
|
||||
memcpy((char *)parser->msgbuf + parser->cur_size, buf, s);
|
||||
parser->cur_size += s;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user