valenok/mongoose — pull request #229 by yzt (2013-08-28 01:47:14+00:00)
Title: Potential Issue in `thread_stop` in `worker_thread`

Currently, `worker_thread` calls `thread_stop` immediately *after* is has freed `conn`. I believe this to be potentially a bug, because `thread_stop` does have members of `mg_connection` as parameters. Here, I've just reversed the order of the `free` and the `thread_stop`.

Another potential issue is the incompatibility of the signature of `thread_start` and `thread_stop` and their usage. While these two callbacks declares their first parameter (`user_data`) as `void*`, what gets passed in is actually a `void**` (i.e. `&ctx->user_data` or `&conn->request_info.user_data`.) I believe either the signature should be changed or the `&` in the calls be removed. Here, I haven't change the signature, as I see no use case for actually changing the `user_data`; but that very well might be a useful feature.

The third change is fixing a type in `mongoose.h` file, where `thread_start` is referred to by its old name `thread_setup`.