mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-19 21:13:12 -07:00
Add fallback if getnameinfo fails
This commit is contained in:
parent
9e698dd7c4
commit
89c3175d71
2 changed files with 4 additions and 4 deletions
|
@ -155,7 +155,7 @@ typedef struct chiaki_session_t
|
||||||
bool ps5;
|
bool ps5;
|
||||||
struct addrinfo *host_addrinfos;
|
struct addrinfo *host_addrinfos;
|
||||||
struct addrinfo *host_addrinfo_selected;
|
struct addrinfo *host_addrinfo_selected;
|
||||||
char hostname[128];
|
char hostname[256];
|
||||||
char regist_key[CHIAKI_RPCRYPT_KEY_SIZE];
|
char regist_key[CHIAKI_RPCRYPT_KEY_SIZE];
|
||||||
uint8_t morning[CHIAKI_RPCRYPT_KEY_SIZE];
|
uint8_t morning[CHIAKI_RPCRYPT_KEY_SIZE];
|
||||||
uint8_t did[CHIAKI_RP_DID_SIZE];
|
uint8_t did[CHIAKI_RP_DID_SIZE];
|
||||||
|
|
|
@ -596,11 +596,11 @@ static ChiakiErrorCode session_thread_request_session(ChiakiSession *session, Ch
|
||||||
set_port(sa, htons(SESSION_PORT));
|
set_port(sa, htons(SESSION_PORT));
|
||||||
|
|
||||||
// TODO: this can block, make cancelable somehow
|
// TODO: this can block, make cancelable somehow
|
||||||
int r = getnameinfo(sa, (socklen_t)ai->ai_addrlen, session->connect_info.hostname, sizeof(session->connect_info.hostname), NULL, 0, 0);
|
int r = getnameinfo(sa, (socklen_t)ai->ai_addrlen, session->connect_info.hostname, sizeof(session->connect_info.hostname), NULL, 0, NI_NUMERICHOST);
|
||||||
if(r != 0)
|
if(r != 0)
|
||||||
{
|
{
|
||||||
free(sa);
|
CHIAKI_LOGE(session->log, "getnameinfo failed with %s, filling the hostname with fallback", gai_strerror(r));
|
||||||
continue;
|
memcpy(session->connect_info.hostname, "unknown", 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHIAKI_LOGI(session->log, "Trying to request session from %s:%d", session->connect_info.hostname, SESSION_PORT);
|
CHIAKI_LOGI(session->log, "Trying to request session from %s:%d", session->connect_info.hostname, SESSION_PORT);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue