Re: ENRP Server Hunt Timer
Thomas Dreibholz <[email protected]>
| Newsgroups | gmane.ietf.rserpool |
|---|---|
| Organization | University of Essen, Institute for Experimental Mathematics |
| Message-ID | <[email protected]> |
On Tuesday 02 November 2004 14:16, c s chandrashekaran-A14667 wrote:
> I agree with the upper limit and with the idea of continuing to try (I
> think at the upper limited value of the timer). However it may be simpler
> to keep retrying forever. The application or user, can decide after certain
> number of failures to use ASAP (like register; name resoution etc) whether
> or not to shutdown. We would not need an additional configuration parameter
> in that case.
This would imply an asynchronous API, e.g. the user calls
StartNameResolution(), which initiates the name resolution in background and
returns immediately. Finally, the user application is notified - by signal (a
bad idea!) or callback - and then calls a function GetNameResolutionResult()
- or the user aborts the name resolution when he decides to have waited long
enough. Example:
void callback()
{
Notify main program that name resolution has been successful
}
ok = StartNameResolution();
if(!ok) {
cerr << "ERROR: Unable to initiate name resolution" << endl;
exit(1);
}
Start a timer -> nameResolutionCallback
...
while(...) {
if(Name Resolution Event) {
Name resolution successful!
}
if(Timer Event) {
Name resolution failed!
}
...
}
Probably, the program also has to care for thread safety in the callback
function!
An asynchronous API is quite complicated. Giving a maximum number of trials
directly to a NameResolution() function is much easier to use and much nearer
to the existing DNS name resolution API. Example:
result = NameResolution("MyPoolHandle", 10 Trials)
if(result == NULL) {
cerr << "ERROR: Name resolution failed!" << endl;
exit(1);
}
Best regards
--
=======================================================================
Dipl.-Inform. Thomas Dreibholz
University of Essen, Room ES210
Inst. for Experimental Mathematics Ellernstraße 29
Computer Networking Technology Group D-45326 Essen/Germany
-----------------------------------------------------------------------
E-Mail: [email protected]
Homepage: http://www.exp-math.uni-essen.de/~dreibh
=======================================================================