The sendfile filter method is called when the contents of a file are to be sent. Filters that modify or consume outgoing data might implement the sendfile filter method.
If a filter implements the write filter method but not the sendfile filter method, the server will automatically translate net_sendfile calls to net_write calls. As a result, filters interested in the outgoing data stream do not need to implement the sendfile filter method. However, for performance reasons, filters that implement the write filter method should also implement the sendfile filter method.
int sendfile(FilterLayer *layer, const sendfiledata *data);
The number of bytes consumed, which may be less than the requested amount if an error occurred.
FilterLayer *layer is the filter layer the filter is installed in.
const sendfiledata *sfd identifies the data to send.
int myfilter_sendfile(FilterLayer *layer, const sendfiledata *sfd) { return net_sendfile(layer->lower, sfd); }