lwdclient.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2000, 2001, 2004, 2005, 2007, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $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);
if (result != ISC_R_SUCCESS)
goto freecm;
if (result != 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)) {
goto unlock;
}
/*
* If a recv is already running, don't bother.
*/
goto unlock;
}
/*
* If we have no idle slots, just return success.
*/
goto unlock;
}
/*
* Set the flag to say there is a recv pending. If isc_socket_recv
* fails we will clear the flag otherwise it will be cleared by
* ns_lwdclient_recv.
*/
/*
* Issue the recv. If it fails, return that it did.
*/
r.length = LWRES_RECVLENGTH;
client);
if (result != ISC_R_SUCCESS) {
goto unlock;
}
/*
* Remove the client from the idle list, and put it on the running
* list.
*/
if (destroy)
return (result);
}
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;
}