1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Fix #1543, use getpeername to retrieve client ip. 3.0.92

This commit is contained in:
winlin 2020-01-05 20:06:25 +08:00
parent 498f3c5df9
commit bc6c61e546
5 changed files with 63 additions and 3 deletions

View file

@ -183,11 +183,11 @@ string srs_dns_resolve(string host, int& family)
char* h = (char*)saddr;
socklen_t nbh = sizeof(saddr);
const int r0 = getnameinfo(r->ai_addr, r->ai_addrlen, h, nbh, NULL, 0, NI_NUMERICHOST);
if(!r0) {
family = r->ai_family;
return string(saddr);
}
return "";
}