Actually use zmc_heartbeat_time. Set it on every capture and use it in ShmValid to determine if zmc has gone away.
This commit is contained in:
parent
920556e002
commit
e38e8a2775
|
@ -2505,6 +2505,7 @@ int Monitor::Capture() {
|
|||
packet->timestamp = new struct timeval;
|
||||
packet->image_index = image_count;
|
||||
gettimeofday(packet->timestamp, nullptr);
|
||||
shared_data->zmc_heartbeat_time = packet->timestamp->tv_sec;
|
||||
|
||||
Image* capture_image = image_buffer[index].image;
|
||||
int captureResult = 0;
|
||||
|
|
|
@ -410,7 +410,9 @@ public:
|
|||
bool disconnect();
|
||||
|
||||
inline int ShmValid() const {
|
||||
return shared_data && shared_data->valid;
|
||||
struct timeval now;
|
||||
gettimeofday(&now, nullptr);
|
||||
return shared_data && shared_data->valid && ((now.tv_sec - shared_data->zmc_heartbeat_time) > config.watch_max_delay);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue