Merge pull request #1467 from sogou/win-dev

Fix kafka compiling problem
This commit is contained in:
xiehan
2024-01-09 16:25:03 +08:00
committed by GitHub
5 changed files with 31 additions and 29 deletions
+2 -1
View File
@@ -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)
+1 -2
View File
@@ -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;
+25
View File
@@ -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;
+1 -24
View File
@@ -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)
{
+2 -2
View File
@@ -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;
}