I am running into problems with my MHD server. I may be confusing the order of the various callback functions. As a result, my server sometimes will sometimes de-reference and allocated structure after it has been freed.
I allocate a private data structure in the default_handler, and free it in the notify_complete handler. This generally works fine with most requests. However, if MHD enforces a connection timeout I will get a call to the request MHD_ContentReaderCallback function after the notify_complete has been called. That means the MHD_ContentReaderCallback function cannot access any data allocated in the default_handler. That is why my server sometimes crashes when a connection has been timed out. My question is what is the order that these 3 callback functions are called (default_handler, notify_complete, MHD_ContentReaderCallback) and if I allocate local data in the default_handler, where do I free it? Note: I have several different ways to process a request. Some request use a MHD_ContentReaderCallback and some do not. So I cannot free the data allocated in the default_handler in the MHD_ContentReaderCallback. Thanks, -eivind
