Index: motion.h =================================================================== --- motion.h (revision 292) +++ motion.h (working copy) @@ -347,6 +347,8 @@ time_t eventtime; time_t connectionlosttime; /* timestamp from connection lost */ + int first_header_error_minute; /* minute when first_header error occurred, so we only log one error per minute */ + int lastrate; unsigned short int moved; unsigned short int pause; Index: netcam.c =================================================================== --- netcam.c (revision 292) +++ netcam.c (working copy) @@ -1565,7 +1565,21 @@ "Error in header (%d)", retval); } /* need to have a dynamic delay here */ - continue; + /* If this error has already occurred in this minute, do not repeat to avoid log-flooding */ + if (netcam->cnt->first_header_error_minute != netcam->cnt->currenttime_tm->tm_min ) + { + /* Record the minute when the error occurred */ + netcam->cnt->first_header_error_minute = netcam->cnt->currenttime_tm->tm_min; + /* And let it happen this time */ + continue; + } + else { + /* Second or subsequent error in this minute - ignore it */ + /* We achieve this by sleeping for 1 minute, since we're in the While loop */ + /* and there's nothing else to do. */ + SLEEP (60,0); + netcam->cnt->first_header_error_minute = -1; /* And turn off the flag until next time */ + }; } } else { /* Streaming */ if (netcam_read_next_header(netcam) < 0) {