From 0e24b037856cbe3116dcfc607d75556cc8c7f896 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 24 Aug 2021 10:23:24 -0400 Subject: [PATCH] Make failure to resolve non fatal --- src/zm_remote_camera.cpp | 3 ++- src/zm_remote_camera_http.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/zm_remote_camera.cpp b/src/zm_remote_camera.cpp index 5e3dfefae..9cb948352 100644 --- a/src/zm_remote_camera.cpp +++ b/src/zm_remote_camera.cpp @@ -100,7 +100,8 @@ void RemoteCamera::Initialise() { int ret = getaddrinfo(host.c_str(), port.c_str(), &hints, &hp); if ( ret != 0 ) { - Fatal( "Can't getaddrinfo(%s port %s): %s", host.c_str(), port.c_str(), gai_strerror(ret) ); + Error( "Can't getaddrinfo(%s port %s): %s", host.c_str(), port.c_str(), gai_strerror(ret) ); + return; } struct addrinfo *p = nullptr; int addr_count = 0; diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index f09db425e..04746c577 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -144,6 +144,14 @@ void RemoteCameraHttp::Initialise() { int RemoteCameraHttp::Connect() { struct addrinfo *p = nullptr; + if (!hp) { + RemoteCamera::Initialise(); + if (!hp) { + Error("Unable to resolve address for remote camera, aborting"); + return -1; + } + } + for ( p = hp; p != nullptr; p = p->ai_next ) { sd = socket( p->ai_family, p->ai_socktype, p->ai_protocol ); if ( sd < 0 ) {