From 310193791d40b7a7ab4fea9777709a89e95dda97 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 4 Feb 2018 11:54:11 -0800 Subject: [PATCH 1/2] add a 10 second sleep before reconneting --- src/zmc.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zmc.cpp b/src/zmc.cpp index eeb9bea16..8659622a9 100644 --- a/src/zmc.cpp +++ b/src/zmc.cpp @@ -342,6 +342,7 @@ int main(int argc, char *argv[]) { delete [] capture_delays; delete [] next_delays; delete [] last_capture_times; + sleep(10); } // end while ! zm_terminate outer connection loop for ( int i = 0; i < n_monitors; i++ ) { From af67e3b686c487f0b8b5703c6281bb232deb4bc8 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 4 Feb 2018 11:54:25 -0800 Subject: [PATCH 2/2] whitespace --- src/zm_remote_camera_http.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/zm_remote_camera_http.cpp b/src/zm_remote_camera_http.cpp index f1f3ec427..c22816747 100644 --- a/src/zm_remote_camera_http.cpp +++ b/src/zm_remote_camera_http.cpp @@ -121,21 +121,17 @@ void RemoteCameraHttp::Initialise() state = HEADER; } -int RemoteCameraHttp::Connect() -{ +int RemoteCameraHttp::Connect() { struct addrinfo *p; - for(p = hp; p != NULL; p = p->ai_next) - { + for ( p = hp; p != NULL; p = p->ai_next ) { sd = socket( p->ai_family, p->ai_socktype, p->ai_protocol ); - if ( sd < 0 ) - { + if ( sd < 0 ) { Warning("Can't create socket: %s", strerror(errno) ); continue; } - if ( connect( sd, p->ai_addr, p->ai_addrlen ) < 0 ) - { + if ( connect( sd, p->ai_addr, p->ai_addrlen ) < 0 ) { close(sd); sd = -1; char buf[sizeof(struct in6_addr)]; @@ -151,14 +147,14 @@ int RemoteCameraHttp::Connect() break; } - if(p == NULL) { + if ( p == NULL ) { Error("Unable to connect to the remote camera, aborting"); - return( -1 ); + return -1; } - Debug( 3, "Connected to host, socket = %d", sd ); - return( sd ); -} + Debug(3, "Connected to host, socket = %d", sd); + return sd; +} // end int RemoteCameraHttp::Connect() int RemoteCameraHttp::Disconnect() { @@ -1063,8 +1059,8 @@ int RemoteCameraHttp::PreCapture() { if ( sd < 0 ) { Connect(); if ( sd < 0 ) { - Error( "Unable to connect to camera" ); - return( -1 ); + Error("Unable to connect to camera"); + return -1; } mode = SINGLE_IMAGE; buffer.clear();