diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 729df665cd..cc08d108c5 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -12,6 +12,7 @@ * Fixed a possible crash for TRoE and attributes of type Vocab/Json/Language * Forbidden to DELETE the Core Context !!! (it can be reloaded) * Bug fix: JSON NULL literal is no longer forwarded! + * Improved treatment of malfunctioning notification receivers, on timeout (for clients that don't respond to the notification) ## New Features: * Support for attributes of type VocabularyProperty diff --git a/src/lib/orionld/notifications/orionldAlterationsTreat.cpp b/src/lib/orionld/notifications/orionldAlterationsTreat.cpp index 29f8211b0e..1b619ef7c8 100644 --- a/src/lib/orionld/notifications/orionldAlterationsTreat.cpp +++ b/src/lib/orionld/notifications/orionldAlterationsTreat.cpp @@ -150,6 +150,7 @@ bool notificationResponseRead // Initial read // bytesRead = readWithTimeout(npP->fd, buf, bufLen - 1, 0, 100000); + if (bytesRead <= 0) { notificationFailure(npP->subP, "Unable to read from notification endpoint", notificationTime); @@ -681,12 +682,13 @@ void orionldAlterationsTreat(OrionldAlteration* altList) npP = npP->next; } + } - if (time(NULL) > startTime + 4) - { - timeout = true; - break; - } + time_t now = time(NULL); + if (now > startTime + 2) + { + timeout = true; + break; } } @@ -703,6 +705,7 @@ void orionldAlterationsTreat(OrionldAlteration* altList) { notificationFailure(npP->subP, "Timeout awaiting response from notification endpoint", notificationTime); + LM_T(LmtNotificationSend, ("Closing fd %d after timeout", npP->fd)); close(npP->fd); npP->fd = -1;