pull/2/head
Jeff Weston 2019-09-11 12:09:35 -04:00
parent bf41edfbff
commit 5be33c4e24
3 changed files with 32 additions and 14 deletions

View File

@ -1,5 +1,14 @@
NORM Version History NORM Version History
Version 1.5b4
=============
- Corrected change in behavior of non-blocking version of
NormGetNextEvent() call to be consistent with documentation
Version 1.5b3
=============
- Added API functions to support integration of NORM into ZeroMQ
Version 1.5b2 Version 1.5b2
============= =============
- Fixed bug with "graceful" stream closure when the sender application - Fixed bug with "graceful" stream closure when the sender application

View File

@ -36,6 +36,6 @@
#ifndef _NORM_VERSION #ifndef _NORM_VERSION
#define _NORM_VERSION #define _NORM_VERSION
#define VERSION "1.5b2" #define VERSION "1.5b4"
#endif // _NORM_VERSION #endif // _NORM_VERSION

View File

@ -456,7 +456,7 @@ void NormInstance::PurgeSessionNotifications(NormSessionHandle sessionHandle)
{ {
Notification* prev = NULL; Notification* prev = NULL;
Notification* next = notify_queue.GetHead(); Notification* next = notify_queue.GetHead();
while (next) while (NULL != next)
{ {
if (next->event.session == sessionHandle) if (next->event.session == sessionHandle)
{ {
@ -546,9 +546,19 @@ bool NormInstance::GetNextEvent(NormEvent* theEvent)
default: default:
break; break;
} }
if (NULL != theEvent) *theEvent = n->event; break;
}
if (NULL != n)
{
previous_notification = n; // keep dispatched event for garbage collection previous_notification = n; // keep dispatched event for garbage collection
return true; if (NULL != theEvent) *theEvent = n->event;
}
else if (NULL != theEvent)
{
theEvent->type = NORM_EVENT_INVALID;
theEvent->session = NORM_SESSION_INVALID;
theEvent->sender = NORM_SESSION_INVALID;
theEvent->object = NORM_SESSION_INVALID;
} }
if (notify_queue.IsEmpty()) if (notify_queue.IsEmpty())
{ {
@ -560,7 +570,7 @@ bool NormInstance::GetNextEvent(NormEvent* theEvent)
while (read(notify_fd[0], byte, 32) > 0); // TBD - error check while (read(notify_fd[0], byte, 32) > 0); // TBD - error check
#endif // if/else WIN32/UNIX #endif // if/else WIN32/UNIX
} }
return false; return (NULL != n);
} // end NormInstance::GetNextEvent() } // end NormInstance::GetNextEvent()
bool NormInstance::WaitForEvent() bool NormInstance::WaitForEvent()
@ -813,8 +823,8 @@ NormDescriptor NormGetDescriptor(NormInstanceHandle instanceHandle)
NORM_API_LINKAGE NORM_API_LINKAGE
bool NormGetNextEvent(NormInstanceHandle instanceHandle, NormEvent* theEvent, bool waitForEvent) bool NormGetNextEvent(NormInstanceHandle instanceHandle, NormEvent* theEvent, bool waitForEvent)
{ {
bool result = false;
NormInstance* instance = (NormInstance*)instanceHandle; NormInstance* instance = (NormInstance*)instanceHandle;
bool result = false;
if (instance) if (instance)
{ {
if (instance->dispatcher.SuspendThread()) if (instance->dispatcher.SuspendThread())
@ -828,6 +838,8 @@ bool NormGetNextEvent(NormInstanceHandle instanceHandle, NormEvent* theEvent, bo
if (!instance->WaitForEvent()) if (!instance->WaitForEvent())
{ {
// Indication that NormInstance is dead // Indication that NormInstance is dead
// TBD - how do we inform app although this shouldn't
// happen unless the app destroys the "instance"
return false; return false;
} }
// re-suspend thread after wait // re-suspend thread after wait
@ -838,10 +850,7 @@ bool NormGetNextEvent(NormInstanceHandle instanceHandle, NormEvent* theEvent, bo
instance->dispatcher.ResumeThread(); instance->dispatcher.ResumeThread();
} }
} }
// We do this so we only return "false" when NormInstance is dead return result;
if (!result && (NULL != theEvent))
theEvent->type = NORM_EVENT_INVALID;
return true;
} // end NormGetNextEvent() } // end NormGetNextEvent()
@ -882,11 +891,11 @@ void NormDestroySession(NormSessionHandle sessionHandle)
if (instance->dispatcher.SuspendThread()) if (instance->dispatcher.SuspendThread())
{ {
NormSession* session = (NormSession*)sessionHandle; NormSession* session = (NormSession*)sessionHandle;
if (session) if (NULL != session)
{ {
session->Close(); session->Close();
session->GetSessionMgr().DeleteSession(session); session->GetSessionMgr().DeleteSession(session);
instance->PurgeSessionNotifications(sessionHandle); instance->PurgeSessionNotifications(sessionHandle);
} }
instance->dispatcher.ResumeThread(); instance->dispatcher.ResumeThread();
} }