callback + handle_eof