Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix kafka compiling problem #1467

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/client/WFKafkaClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 1 addition & 2 deletions src/client/WFKafkaClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
25 changes: 25 additions & 0 deletions src/protocol/KafkaDataTypes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
25 changes: 1 addition & 24 deletions src/protocol/KafkaDataTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -551,30 +551,7 @@ class KafkaConfig
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)
{
Expand Down
4 changes: 2 additions & 2 deletions src/protocol/kafka_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Loading