lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

The problem with persistent connections is that your code has to be
robust to the server sending 100 status or not, and closing the
connection on you or not. I am sure different servers will disrespect
the standard in different ways, which means more debugging. You also
need to create an API that hides this complexity from the user in some
way.

It would have taken me a lot more than 15 minutes to do it, so it
would be great if Mr. Quack could find that piece of code... :)

> I looked at the C code but as I said earlier even when commenting out
> all the close() calls I could find getfd() still returned -1.  I could
> see the server closing it's side, but that should still leave the local
> fd unchanged (though of course no longer usable if the server really
> closed the connection), no?

If getfd() is returning -1 then somewhere some C code wrote -1 to the socket.
Look for SOCKET_INVALID. I would have happened either in usocket.c or
in wsocket.c. Somebody is calling socket_destroy() on this socket.

Regards,
Diego

PS: On the other hand, if the server is closing the connection, then
you have other problems to solve as well.