More http error logs

This commit is contained in:
Henrik Rydgård 2023-09-17 11:27:06 +02:00
parent b6515ef1e6
commit 405e179f09
3 changed files with 5 additions and 2 deletions

View File

@ -324,6 +324,7 @@ int Client::SendRequestWithData(const char *method, const RequestParams &req, co
buffer.Append(data);
bool flushed = buffer.FlushSocket(sock(), dataTimeout_, progress->cancelled);
if (!flushed) {
WARN_LOG(HTTP, "SendRequestWithData failed: resource: %s agent=%s", req.resource.c_str(), userAgent_.c_str());
return -1; // TODO error code.
}
return 0;

View File

@ -9,6 +9,7 @@
#endif
#include <algorithm>
#include <cstring>
#include <cerrno>
#ifndef MSG_NOSIGNAL
// Default value to 0x00 (do nothing) in systems where it's not supported.
@ -51,7 +52,7 @@ bool Buffer::FlushSocket(uintptr_t sock, double timeout, bool *cancelled) {
int sent = send(sock, &data_[pos], (int)(end - pos), MSG_NOSIGNAL);
// TODO: Do we need some retry logic here, instead of just giving up?
if (sent < 0) {
ERROR_LOG(IO, "FlushSocket failed to send: %d", errno);
ERROR_LOG(IO, "FlushSocket failed to send: %d (%s)", errno, strerror(errno));
return false;
}
pos += sent;

View File

@ -217,7 +217,7 @@ static void server_call_callback(const rc_api_request_t *request,
}
static void log_message_callback(const char *message, const rc_client_t *client) {
INFO_LOG(ACHIEVEMENTS, "RetroAchievements: %s", message);
INFO_LOG(ACHIEVEMENTS, "RA: %s", message);
}
// For detailed documentation, see https://github.com/RetroAchievements/rcheevos/wiki/rc_client_set_event_handler.
@ -411,6 +411,7 @@ void Initialize() {
rc_client_enable_logging(g_rcClient, RC_CLIENT_LOG_LEVEL_VERBOSE, log_message_callback);
if (!System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) {
INFO_LOG(ACHIEVEMENTS, "Falling back to HTTP host, no HTTPS support detected");
// Disable SSL if not supported by our platform implementation.
rc_client_set_host(g_rcClient, "http://retroachievements.org");
}