circonus-labs/reconnoiter — pull request #188 by pamaddox (2014-01-30 18:18:56+00:00)
Title: Add Protections From Simultaneous HTTP Writes

It was possible to have two separate threads do an HTTP write at
the same time if a user is doing an HTTP flush. Add a flag to the
CTX structure when an HTTP write is in progress and if it is,
return 0. The data will still be written from the other thread, so
we don't need to wait until the function is clear and try writing
again.

When ending an HTTP response, wait a while before exiting, since we
want to make sure that there are no extra writes going on. After
a little while, though, just return 0.