lwdclient.c revision ec5347e2c775f027573ce5648b910361aa926c01
/*
* Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001 Internet Software Consortium.
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwdclient.c,v 1.22 2007/06/18 23:47:18 tbox Exp $ */
/*! \file */
#include <config.h>
#include <named/lwdclient.h>
static void
void
}
{
unsigned int i;
return (ISC_R_NOMEMORY);
!= ISC_R_SUCCESS)
goto errout;
for (i = 0; i < nclients; i++) {
}
}
/*
* If we could create no clients, clean up and return.
*/
goto errout;
if (result != ISC_R_SUCCESS)
goto errout;
/*
* This MUST be last, since there is no way to cancel an onshutdown...
*/
cm);
if (result != ISC_R_SUCCESS)
goto errout;
return (ISC_R_SUCCESS);
}
return (result);
}
static void
if (!SHUTTINGDOWN(cm))
return;
/*
* run through the idle list and free the clients there. Idle
* clients do not have a recv running nor do they have any finds
* or similar running.
*/
}
return;
}
static void
if (result != ISC_R_SUCCESS) {
goto restart;
}
return;
return;
return;
case LWRES_OPCODE_NOOP:
return;
default:
goto restart;
}
/*
* Drop the packet.
*/
}
void
ns_lwdclient_log(50,
"event received: task %p, length %u, result %u (%s)",
isc_event_free(&ev);
/*
* Go idle.
*/
return;
}
} else
isc_event_free(&ev);
if (result != ISC_R_SUCCESS)
"could not start lwres "
"client handler: %s",
}
/*
* This function will start a new recv() on a socket for this client manager.
*/
isc_region_t r;
if (SHUTTINGDOWN(cm)) {
return (ISC_R_SUCCESS);
}
/*
* If a recv is already running, don't bother.
*/
return (ISC_R_SUCCESS);
/*
* If we have no idle slots, just return success.
*/
return (ISC_R_SUCCESS);
/*
* Issue the recv. If it fails, return that it did.
*/
r.length = LWRES_RECVLENGTH;
client);
if (result != ISC_R_SUCCESS)
return (result);
/*
* Set the flag to say we've issued a recv() call.
*/
/*
* Remove the client from the idle list, and put it on the running
* list.
*/
return (ISC_R_SUCCESS);
}
static void
/*
* run through the idle list and free the clients there. Idle
* clients do not have a recv running nor do they have any finds
* or similar running.
*/
}
/*
* Cancel any pending I/O.
*/
/*
* Run through the running client list and kill off any finds
* in progress.
*/
}
isc_event_free(&ev);
}
/*
* Do all the crap needed to move a client from the run queue to the idle
* queue.
*/
void
if (result != ISC_R_SUCCESS)
"could not start lwres "
"client handler: %s",
}
void
client->sendlength);
client->sendlength = 0;
isc_event_free(&ev);
}
struct in6_pktinfo *pktinfo;
if (client->pktinfo_valid)
else
}
void
client->recvlength = 0;
client->sendlength = 0;
client->find_wanted = 0;
}