From 5aef71fe057bb08871174bcbbedba977a13ac367 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 27 Jun 2002 23:54:01 +0000 Subject: [PATCH] changed interface so that callback is immediate if there is no space in the queue --- src/libCom/misc/ipAddrToAsciiAsynchronous.cpp | 16 +++++++++------- src/libCom/misc/ipAddrToAsciiAsynchronous.h | 5 ++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/libCom/misc/ipAddrToAsciiAsynchronous.cpp b/src/libCom/misc/ipAddrToAsciiAsynchronous.cpp index 20ab1d9c3..c6de17620 100644 --- a/src/libCom/misc/ipAddrToAsciiAsynchronous.cpp +++ b/src/libCom/misc/ipAddrToAsciiAsynchronous.cpp @@ -82,6 +82,7 @@ void ipAddrToAsciiEngine::run () { epicsGuard < epicsMutex > locker ( ipAddrToAsciiEngine::mutex ); if ( this->pCurrent ) { + this->pCurrent->pEngine = 0; this->callbackInProgress = true; } else { @@ -94,10 +95,7 @@ void ipAddrToAsciiEngine::run () { epicsGuard < epicsMutex > locker ( ipAddrToAsciiEngine::mutex ); - if ( this->pCurrent ) { - this->pCurrent->pEngine = 0; - this->pCurrent = 0; - } + this->pCurrent = 0; this->callbackInProgress = false; } if ( this->cancelPending ) { @@ -173,7 +171,7 @@ ipAddrToAsciiAsynchronous::~ipAddrToAsciiAsynchronous () } } -epicsShareFunc bool ipAddrToAsciiAsynchronous::ioInitiate ( ipAddrToAsciiEngine & engine ) +epicsShareFunc void ipAddrToAsciiAsynchronous::ioInitiate ( ipAddrToAsciiEngine & engine ) { bool success; @@ -193,8 +191,12 @@ epicsShareFunc bool ipAddrToAsciiAsynchronous::ioInitiate ( ipAddrToAsciiEngine if ( success ) { engine.laborEvent.signal (); } - - return success; + else { + char autoNameTmp[256]; + sockAddrToA ( &this->addr.sa, autoNameTmp, + sizeof ( autoNameTmp ) ); + this->ioCompletionNotify ( autoNameTmp ); + } } void ipAddrToAsciiAsynchronous::show ( unsigned level ) const diff --git a/src/libCom/misc/ipAddrToAsciiAsynchronous.h b/src/libCom/misc/ipAddrToAsciiAsynchronous.h index 6bf3f42e9..e886b9084 100644 --- a/src/libCom/misc/ipAddrToAsciiAsynchronous.h +++ b/src/libCom/misc/ipAddrToAsciiAsynchronous.h @@ -56,15 +56,14 @@ private: // - this class implements the asynchronous DNS query // - it completes early with the host name in dotted IP address form // if the ipAddrToAsciiEngine is destroyed before IO completion -// - ioInitiate fails if there are too many items already in -// the engine's queue. +// or if there are too many items already in the engine's queue. // class ipAddrToAsciiAsynchronous : public tsDLNode < ipAddrToAsciiAsynchronous > { public: epicsShareFunc ipAddrToAsciiAsynchronous ( const osiSockAddr & addr ); epicsShareFunc virtual ~ipAddrToAsciiAsynchronous (); - epicsShareFunc bool ioInitiate ( ipAddrToAsciiEngine &engine ); + epicsShareFunc void ioInitiate ( ipAddrToAsciiEngine & engine ); epicsShareFunc bool identicalAddress ( const osiSockAddr & addr ) const; epicsShareFunc osiSockAddr address () const; epicsShareFunc void show ( unsigned level ) const;