On 2/26/2015 1:00 PM, Jacob Champion wrote: > In this case, if I can get the input socket, I might be able to > construct an APR_POLLSET_WAKEABLE pollset around it, and use > apr_pollset_wakeup() to break out of the poll whenever I want to write > output.
It turns out this works pretty well. The key complication is that the wakeup is lossy (multiple simultaneous wakeups are treated as one) so it's important to drain the entire "message queue" before polling again. I borrowed mod_spdy's sort-of-busy-loop approach to do that, and I used mod_proxy_wstunnel's poll-on-the-input-socket approach to block. The result is a mod_websocket that hasn't crashed yet during overnight TLS stress tests (it used to crash regularly within a couple of seconds of starting). I was also able to remove the extra pool and bucket allocator that Alex added, since reading and writing are now done using only a single thread. I'm waiting on internal approval to post the five-patch set here (unless of course there is any objection from the mailing list; I don't see a lot of patch mail in the archives). It would make more sense to contribute directly to the original author, if said author were still around... Thanks, Alex and Eric, for your suggestions! Jacob Champion LabVIEW R&D National Instruments