Skip to content

Conversation

@AndreySmirdin
Copy link

Задание 1 из дополнительной методички.
Лиза -- сервер, Андрей -- клиент


while (true) {
client.GetLine(line);
if (sscanf(line.c_str(), "a customer %s", arg)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Желательно указывать размер буфера arg, чтобы не произошло переполнение.

}

bool Message::GetBody(std::string *body, size_t length, int sockfd) {
auto buf = new char[length];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем выделять buf, если можно было сразу передать body->data() в Get? Естественно, после resize.

return status;
}

MarketServer::ClientStatus MarketServer::WorkWithFreelancer(Freelancer *freelancer, const Message &message) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Достаточно большие функции, которые можно было бы разбить на несколько.

@h31
Copy link
Owner

h31 commented Mar 27, 2019

А так всё достаточно хорошо и красиво, молодцы.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants