* Return a pointer to the netmgr object for the given handle.
*/
-typedef void (*isc_nm_recv_cb_t)(isc_nmhandle_t *handle, isc_region_t *region,
- void *cbarg);
+typedef void (*isc_nm_recv_cb_t)(isc_nmhandle_t *handle, isc_result_t eresult,
+ isc_region_t *region, void *cbarg);
/*%<
* Callback function to be used when receiving a packet.
*
* 'handle' the handle that can be used to send back the answer.
- * 'region' contains the received data. It will be freed after
- * return by caller.
+ * 'eresult' the result of the event.
+ * 'region' contains the received data, if any. It will be freed
+ * after return by caller.
* 'cbarg' the callback argument passed to isc_nm_listenudp(),
* isc_nm_listentcpdns(), or isc_nm_read().
*/
-typedef void (*isc_nm_cb_t)(isc_nmhandle_t *handle, isc_result_t result,
+typedef void (*isc_nm_cb_t)(isc_nmhandle_t *handle, isc_result_t eresult,
void *cbarg);
/*%<
* Callback function for other network completion events (send, connect,
* accept).
*
* 'handle' the handle on which the event took place.
- * 'result' the result of the event.
+ * 'eresult' the result of the event.
* 'cbarg' the callback argument passed to isc_nm_send(),
* isc_nm_tcp_connect(), or isc_nm_listentcp()
*/
isc_quota_detach(&sock->quota);
}
if (sock->rcb.recv != NULL) {
- sock->rcb.recv(sock->tcphandle, NULL, sock->rcbarg);
+ sock->rcb.recv(sock->tcphandle, ISC_R_TIMEDOUT, NULL,
+ sock->rcbarg);
}
}
.length = nread };
if (sock->rcb.recv != NULL) {
- sock->rcb.recv(sock->tcphandle, ®ion, sock->rcbarg);
+ sock->rcb.recv(sock->tcphandle, ISC_R_SUCCESS, ®ion,
+ sock->rcbarg);
}
sock->read_timeout = (atomic_load(&sock->keepalive)
*/
if (sock->rcb.recv != NULL) {
isc__nm_incstats(sock->mgr, sock->statsindex[STATID_RECVFAIL]);
- sock->rcb.recv(sock->tcphandle, NULL, sock->rcbarg);
+ sock->rcb.recv(sock->tcphandle, ISC_R_EOF, NULL, sock->rcbarg);
}
/*
if (sock->type == isc_nm_tcpsocket && sock->tcphandle != NULL &&
sock->rcb.recv != NULL)
{
- sock->rcb.recv(sock->tcphandle, NULL, sock->rcbarg);
+ sock->rcb.recv(sock->tcphandle, ISC_R_CANCELED, NULL,
+ sock->rcbarg);
}
}
*/
static void
-dnslisten_readcb(isc_nmhandle_t *handle, isc_region_t *region, void *arg);
+dnslisten_readcb(isc_nmhandle_t *handle, isc_result_t eresult,
+ isc_region_t *region, void *arg);
static void
resume_processing(void *arg);
if (listener != NULL && listener->rcb.recv != NULL) {
listener->rcb.recv(
- dnshandle,
+ dnshandle, ISC_R_SUCCESS,
&(isc_region_t){ .base = dnssock->buf + 2,
.length = len },
listener->rcbarg);
* a complete DNS packet and, if so - call the callback
*/
static void
-dnslisten_readcb(isc_nmhandle_t *handle, isc_region_t *region, void *arg) {
+dnslisten_readcb(isc_nmhandle_t *handle, isc_result_t eresult,
+ isc_region_t *region, void *arg) {
isc_nmsocket_t *dnssock = (isc_nmsocket_t *)arg;
unsigned char *base = NULL;
bool done = false;
REQUIRE(VALID_NMHANDLE(handle));
REQUIRE(dnssock->tid == isc_nm_tid());
- if (region == NULL) {
+ if (region == NULL || eresult != ISC_R_SUCCESS) {
/* Connection closed */
isc_nmhandle_unref(handle);
+ dnssock->result = eresult;
if (dnssock->self != NULL) {
isc__nmsocket_detach(&dnssock->self);
}
region.length = nrecv;
INSIST(sock->rcb.recv != NULL);
- sock->rcb.recv(nmhandle, ®ion, sock->rcbarg);
+ sock->rcb.recv(nmhandle, ISC_R_SUCCESS, ®ion, sock->rcbarg);
if (free_buf) {
isc__nm_free_uvbuf(sock, buf);
}
* or tcpmsg (TCP case).
*/
void
-ns__client_request(isc_nmhandle_t *handle, isc_region_t *region, void *arg) {
+ns__client_request(isc_nmhandle_t *handle, isc_result_t eresult,
+ isc_region_t *region, void *arg) {
ns_client_t *client;
bool newclient = false;
ns_clientmgr_t *mgr;
#endif /* ifdef HAVE_DNSTAP */
ifp = (ns_interface_t *)arg;
+ UNUSED(eresult);
+
mgr = ifp->clientmgr;
if (mgr == NULL) {
/* The interface was shut down in the meantime, just bail */
*/
void
-ns__client_request(isc_nmhandle_t *handle, isc_region_t *region, void *arg);
+ns__client_request(isc_nmhandle_t *handle, isc_result_t eresult,
+ isc_region_t *region, void *arg);
/*%<
* Handle client requests.