close: make close notification go through writable
authorAndy Green <andy@warmcat.com>
Mon, 17 Jul 2017 02:11:17 +0000 (10:11 +0800)
committerAndy Green <andy@warmcat.com>
Wed, 19 Jul 2017 00:55:57 +0000 (08:55 +0800)
commit3b0066cb3fec6baee98a3dcb2cecf11463453ed5
tree45b66aa695200944910e2ef8ac276992abc191e8
parentfaa1526b394ac85d023b62d11fc436dd713efb4c
close: make close notification go through writable

Until now we took the approach if just writing the close notification
broke something, we didn't care because we were closing the connection
anyway.

But with lws_meta, breaking stuff in the parent connection would be a
sticky problem outliving the closing child connection.

So this adds a new wsi state LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION
and makes the send go via the writable callback mechanism.
lib/client-parser.c
lib/handshake.c
lib/libwebsockets.c
lib/libwebsockets.h
lib/private-libwebsockets.h
lib/service.c