Yes, check the send_iobuf
length before mg_send_
, and if it is larger than some reasonable threshold, do not send but rather wait for another poll cycle. This is what default file handler does.
See https://github.com/cesanta/mongoose/blob/master/src/mg_http.c
Function mg_http_transfer_file_data()