mirror of
https://git.wownero.com/wownero/wownero-puddle.git
synced 2024-08-15 01:03:20 +00:00
reolved merge conflict
This commit is contained in:
commit
a517714d28
1 changed files with 20 additions and 1 deletions
21
src/pool.c
21
src/pool.c
|
@ -2073,10 +2073,14 @@ client_on_read(struct bufferevent *bev, void *ctx)
|
||||||
input = bufferevent_get_input(bev);
|
input = bufferevent_get_input(bev);
|
||||||
output = bufferevent_get_output(bev);
|
output = bufferevent_get_output(bev);
|
||||||
|
|
||||||
if (evbuffer_get_length(input) >= MAX_LINE)
|
size_t len = evbuffer_get_length(input);
|
||||||
|
if (len >= MAX_LINE)
|
||||||
{
|
{
|
||||||
const char *too_long = "Message too long\n";
|
const char *too_long = "Message too long\n";
|
||||||
evbuffer_add(output, too_long, strlen(too_long));
|
evbuffer_add(output, too_long, strlen(too_long));
|
||||||
|
log_info("Removing client. Message too long.");
|
||||||
|
evbuffer_drain(input, len);
|
||||||
|
client_clear(bev);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2089,11 +2093,14 @@ client_on_read(struct bufferevent *bev, void *ctx)
|
||||||
const char unknown[] = "Unknown method";
|
const char unknown[] = "Unknown method";
|
||||||
client->json_id = json_object_get_int(id);
|
client->json_id = json_object_get_int(id);
|
||||||
|
|
||||||
|
bool unknown_message = false;
|
||||||
|
|
||||||
if (method_name == NULL)
|
if (method_name == NULL)
|
||||||
{
|
{
|
||||||
char body[ERROR_BODY_MAX];
|
char body[ERROR_BODY_MAX];
|
||||||
stratum_get_error_body(body, client->json_id, unknown);
|
stratum_get_error_body(body, client->json_id, unknown);
|
||||||
evbuffer_add(output, body, strlen(body));
|
evbuffer_add(output, body, strlen(body));
|
||||||
|
unknown_message = true;
|
||||||
}
|
}
|
||||||
else if (strcmp(method_name, "login") == 0)
|
else if (strcmp(method_name, "login") == 0)
|
||||||
{
|
{
|
||||||
|
@ -2118,10 +2125,22 @@ client_on_read(struct bufferevent *bev, void *ctx)
|
||||||
char body[ERROR_BODY_MAX];
|
char body[ERROR_BODY_MAX];
|
||||||
stratum_get_error_body(body, client->json_id, unknown);
|
stratum_get_error_body(body, client->json_id, unknown);
|
||||||
evbuffer_add(output, body, strlen(body));
|
evbuffer_add(output, body, strlen(body));
|
||||||
|
unknown_message = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
json_object_put(message);
|
json_object_put(message);
|
||||||
free(line);
|
free(line);
|
||||||
|
|
||||||
|
if (unknown_message)
|
||||||
|
{
|
||||||
|
char *body = stratum_new_error_body(client->json_id, unknown);
|
||||||
|
evbuffer_add(output, body, strlen(body));
|
||||||
|
free(body);
|
||||||
|
log_info("Removing client. Unknown message.");
|
||||||
|
evbuffer_drain(input, len);
|
||||||
|
client_clear(bev);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue