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>
diff --git a/lib/client-handshake.c b/lib/client-handshake.c
index 8c821ef..c6f8ba3 100644
--- a/lib/client-handshake.c
+++ b/lib/client-handshake.c
@@ -92,6 +92,7 @@
 	wsi->state = WSI_STATE_CLIENT_UNCONNECTED;
 	wsi->pings_vs_pongs = 0;
 	wsi->protocol = NULL;
+	wsi->pending_timeout = NO_PENDING_TIMEOUT;
 
 	/* set up appropriate masking */