ka, ka->client, ka->countToDeath, timeval);
if (ka->countToDeath == 0) {
- VIR_WARN("No response from client %p after %d keepalive messages in"
- " %d seconds",
- ka->client,
- ka->count,
- timeval);
+ VIR_DEBUG("No response from client %p after %d keepalive messages "
+ "in %d seconds",
+ ka->client, ka->count, timeval);
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("connection closed due to keepalive timeout"));
return true;
} else {
ka->countToDeath--;
virKeepAlivePtr keepalive;
bool wantClose;
int closeReason;
+ virErrorPtr error;
virNetClientCloseFunc closeCb;
void *closeOpaque;
int reason)
{
VIR_DEBUG("client=%p, reason=%d", client, reason);
+
if (client->sock)
virNetSocketRemoveIOCallback(client->sock);
+
/* Don't override reason that's already set. */
if (!client->wantClose) {
+ if (!client->error)
+ client->error = virSaveLastError();
client->wantClose = true;
client->closeReason = reason;
}
client->keepalive = NULL;
client->wantClose = false;
+ virFreeError(client->error);
+ client->error = NULL;
+
if (ka || client->closeCb) {
virNetClientCloseFunc closeCb = client->closeCb;
void *closeOpaque = client->closeOpaque;
}
error:
+ if (client->error) {
+ VIR_DEBUG("error on socket: %s", client->error->message);
+ virSetError(client->error);
+ }
virNetClientCallRemove(&client->waitDispatch, thiscall);
virNetClientIOEventLoopPassTheBuck(client, thiscall);
return -1;