mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
keepalive: Resolve Coverity complaint
The Coverity analysis emitted a BAD_SIZEOF error when doing the math within the TRACE macro. Doing the math outside the macro keeps Coverity quiet.
This commit is contained in:
parent
ffd61edd87
commit
1c8c819028
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* virkeepalive.c: keepalive handling
|
* virkeepalive.c: keepalive handling
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Red Hat, Inc.
|
* Copyright (C) 2011-2013 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -117,28 +117,28 @@ virKeepAliveTimerInternal(virKeepAlivePtr ka,
|
|||||||
virNetMessagePtr *msg)
|
virNetMessagePtr *msg)
|
||||||
{
|
{
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
int timeval;
|
||||||
|
|
||||||
if (ka->interval <= 0 || ka->intervalStart == 0)
|
if (ka->interval <= 0 || ka->intervalStart == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (now - ka->intervalStart < ka->interval) {
|
if (now - ka->intervalStart < ka->interval) {
|
||||||
int timeout = ka->interval - (now - ka->intervalStart);
|
timeval = ka->interval - (now - ka->intervalStart);
|
||||||
virEventUpdateTimeout(ka->timer, timeout * 1000);
|
virEventUpdateTimeout(ka->timer, timeval * 1000);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timeval = now - ka->lastPacketReceived;
|
||||||
PROBE(RPC_KEEPALIVE_TIMEOUT,
|
PROBE(RPC_KEEPALIVE_TIMEOUT,
|
||||||
"ka=%p client=%p countToDeath=%d idle=%d",
|
"ka=%p client=%p countToDeath=%d idle=%d",
|
||||||
ka, ka->client, ka->countToDeath,
|
ka, ka->client, ka->countToDeath, timeval);
|
||||||
(int) (now - ka->lastPacketReceived));
|
|
||||||
|
|
||||||
|
|
||||||
if (ka->countToDeath == 0) {
|
if (ka->countToDeath == 0) {
|
||||||
VIR_WARN("No response from client %p after %d keepalive messages in"
|
VIR_WARN("No response from client %p after %d keepalive messages in"
|
||||||
" %d seconds",
|
" %d seconds",
|
||||||
ka->client,
|
ka->client,
|
||||||
ka->count,
|
ka->count,
|
||||||
(int) (now - ka->lastPacketReceived));
|
timeval);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
ka->countToDeath--;
|
ka->countToDeath--;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user