1) Upon initial connection when the full header has been received and maybe part of the body
2) When more data arrives
3) When a send completes
4) On disconnect
There should probably also be a callback when "recon" occurs which I believe indicates a connection failure. Rather than the application having to figure out why the CGI function was called, what about adding a second enum parameter to the CGI function that indicates the reason? Something like this:
enum {
CGI_CALLBACK_CONNECT,
CGI_CALLBACK_RECEIVED_DATA,
CGI_CALLBACK_SEND_COMPLETE,
CGI_CALLBACK_DISCONNECT,
CGI_CALLBACK_CONNECTION_FAILED
};
Is there a reason why this would be a bad idea? If not, I'm going to try implementing it myself and will submit a pull request once the work is done and tested.