Brad Fitzpatrick (bradfitz) wrote in lj_dev,
Brad Fitzpatrick
bradfitz
lj_dev

ah yea'

wrote a bunch of neat code to work around mod_backhand's bug, and i think we're set... also fixed a bunch of signal handling bugs i found from earlier... fixing those involved writing some ugly ass code, which i enjoyed... the signal problem was basically that if you get a SIGTERM, you don't always want to die immediately, else some user could see an error message... you want to always know if you're in a waiting state when the signal handler gets called, or in a serving state... so setting those state flags was interesting, because there were so many different code paths. instead of turning the flag off before every way to get back to the while loop, i changed the while accept loop to look like:

while ((($SERVING=0)||1) && $CONTINUE && FCGI::accept() > 0) {
.....
}

with the signal handler being:

$SIG{'TERM'} = sub {
if ($SERVING) { $CONTINUE = 0; } else { exit 0; }
};

It's not beautiful, but it works finally, and it's late, and I'm happy.

So yeah... the backhand stuff is all working now. you can look at its status page here, or the apache status page here.
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 3 comments