introduce timeout system

This adds a concept of timeouts for operations enforced by
connection closure if the timeout is reached.

Once a second all sockets are checked for timing out, every time
there is a service call it checks to see if a second has passed since
the last check and checks if so.

You can also call libwebsocket_service_fd() with a NULL fd to give
the timeouts a chance to be detected; if it's less than a second since
the last check it returns immediately.

Signed-off-by: Andy Green <andy@warmcat.com>
3 files changed