mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
![]() Until now the uv watcher has been composed in the wsi. This works fine except in the case of a client wsi that meets a redirect when the event loop is libuv with its requirement for handle close via the event loop. We want to reuse the wsi, since the originator of it has a copy of the wsi pointer, and we want to conceal the redirect. Since the redirect is commonly to a different IP, we want to keep the wsi alive while closing its socket cleanly. That's not too difficult, unless you are using uv. With UV the comoposed watcher is a disaster, since after the close is requested the wsi will start to reconnect. We tried to deal with that by copying the uv handle and freeing it when the handle close finalizes. But it turns out the handle is in a linked-list scheme in uv. This patch hopefully finally solves it by giving the uv handle its own allocation from the start. When we want to close the socket and reuse the wsi, we simply take responsibility for freeing the handle and set the wsi watcher pointer to NULL. |
||
---|---|---|
.. | ||
libev.c | ||
private.h |