Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/nscd/nscd.c
Show First 20 Lines • Show All 399 Lines • ▼ Show 20 Lines | if (qstate->use_alternate_io == 0) { | ||||
* we should prepare the query_state's io_XXX fields. | * we should prepare the query_state's io_XXX fields. | ||||
* We should also substitute its write_func and read_func | * We should also substitute its write_func and read_func | ||||
* with the query_io_buffer_write and query_io_buffer_read, | * with the query_io_buffer_write and query_io_buffer_read, | ||||
* which will allow us to implicitly send/receive this large | * which will allow us to implicitly send/receive this large | ||||
* buffer later (in the subsequent calls to the | * buffer later (in the subsequent calls to the | ||||
* process_socket_event). | * process_socket_event). | ||||
*/ | */ | ||||
if (qstate->kevent_watermark > MAX_SOCKET_IO_SIZE) { | if (qstate->kevent_watermark > MAX_SOCKET_IO_SIZE) { | ||||
#if 0 | |||||
/* | |||||
* XXX: Uncommenting this code makes nscd(8) fail for | |||||
* entries larger than a few kB, causing few second | |||||
* worth of delay for each call to retrieve them. | |||||
*/ | |||||
if (qstate->io_buffer != NULL) | if (qstate->io_buffer != NULL) | ||||
free(qstate->io_buffer); | free(qstate->io_buffer); | ||||
qstate->io_buffer = calloc(1, | qstate->io_buffer = calloc(1, | ||||
qstate->kevent_watermark); | qstate->kevent_watermark); | ||||
assert(qstate->io_buffer != NULL); | assert(qstate->io_buffer != NULL); | ||||
qstate->io_buffer_p = qstate->io_buffer; | qstate->io_buffer_p = qstate->io_buffer; | ||||
qstate->io_buffer_size = qstate->kevent_watermark; | qstate->io_buffer_size = qstate->kevent_watermark; | ||||
qstate->io_buffer_filter = qstate->kevent_filter; | qstate->io_buffer_filter = qstate->kevent_filter; | ||||
qstate->write_func = query_io_buffer_write; | qstate->write_func = query_io_buffer_write; | ||||
qstate->read_func = query_io_buffer_read; | qstate->read_func = query_io_buffer_read; | ||||
if (qstate->kevent_filter == EVFILT_READ) | if (qstate->kevent_filter == EVFILT_READ) | ||||
qstate->use_alternate_io = 1; | qstate->use_alternate_io = 1; | ||||
#endif | |||||
qstate->io_buffer_watermark = MAX_SOCKET_IO_SIZE; | qstate->io_buffer_watermark = MAX_SOCKET_IO_SIZE; | ||||
EV_SET(&eventlist[1], event_data->ident, | EV_SET(&eventlist[1], event_data->ident, | ||||
qstate->kevent_filter, EV_ADD | EV_ONESHOT, | qstate->kevent_filter, EV_ADD | EV_ONESHOT, | ||||
NOTE_LOWAT, MAX_SOCKET_IO_SIZE, qstate); | NOTE_LOWAT, MAX_SOCKET_IO_SIZE, qstate); | ||||
} else { | } else { | ||||
EV_SET(&eventlist[1], event_data->ident, | EV_SET(&eventlist[1], event_data->ident, | ||||
qstate->kevent_filter, EV_ADD | EV_ONESHOT, | qstate->kevent_filter, EV_ADD | EV_ONESHOT, | ||||
▲ Show 20 Lines • Show All 439 Lines • Show Last 20 Lines |