SPUG: Closing HTTP::Daemon port

Fred Morris m3047 at inwa.net
Fri Aug 8 22:31:40 CDT 2003


Marc wrote:
>Seems like I knew the answer to this at one time...

I've noticed similar behaviors at times...

>I'm running an HTTP::Daemon on Linux.  It responds to /quit by quitting,
>which it does by exiting its main loop and closing (and undef'ing) the
>HTTP::Daemon object (which is derived from IO::Socket::INET).  So far as I
>know I'm doing all the housekeeping properly.

Are you closing the listener on the socket? Because in order to listen for
connections, you have a listener on it. (how can you test/tell? that's the
thing that's always stumped me.. well sure, netstat. doesn't seem to be
"fast enough" though. I don't trust it.) Are you checking the exit status
before undeffing? Is there somebody trying to make a connect on it when you
close/undef?

>After it quits, I restart it.  For almost a minute the port is still held
>and the HTTP::Daemon object can't be allocated.  I've timed it and it seems
>steady at about 55 seconds.
>
>If I <ctrl-C> to KILL the program it doesn't seem to hold the port.

That I don't quite understand... does the job otherwise stick around as defunct?

>It
>doesn't hold the port running on Windows.

Hey, it's Windows! The only thing it's holding onto is its own...

--

Fred Morris
m3047 at inwa.net





More information about the spug-list mailing list