mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-12-04 01:00:16 -05:00
fix: log the real address when a remote http camera on ipv6 fails to connect
This commit is contained in:
1 parent
fe013898c3
commit
d4c5d128dd
1 file changed
+6
-4
@@ -165,10 +165,12 @@ int RemoteCameraHttp::Connect() {
|
||||
if ( connect( sd, p->ai_addr, p->ai_addrlen ) < 0 ) {
|
||||
close(sd);
|
||||
sd = -1;
|
||||
char buf[INET6_ADDRSTRLEN];
|
||||
struct sockaddr_in *addr;
|
||||
addr = (struct sockaddr_in *)p->ai_addr;
|
||||
inet_ntop(AF_INET, &(addr->sin_addr), buf, sizeof(buf));
|
||||
char buf[INET6_ADDRSTRLEN] = "n/a";
|
||||
if (p->ai_family == AF_INET) {
|
||||
inet_ntop(AF_INET, &((struct sockaddr_in *)p->ai_addr)->sin_addr, buf, sizeof(buf));
|
||||
} else if (p->ai_family == AF_INET6) {
|
||||
inet_ntop(AF_INET6, &((struct sockaddr_in6 *)p->ai_addr)->sin6_addr, buf, sizeof(buf));
|
||||
}
|
||||
|
||||
Warning("Can't connect to remote camera mid: %d at %s: %s", monitor->Id(), buf, strerror(errno));
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user