unify all pollfd lock management
This provides a single place for pollfd event changing,
external locking for that and extpoll management.
It saves about 85 lines of duplication and simplifies the callers.
Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/lib/client-handshake.c b/lib/client-handshake.c
index 31099b8..fc8ffb7 100644
--- a/lib/client-handshake.c
+++ b/lib/client-handshake.c
@@ -82,13 +82,7 @@
* must do specifically a POLLOUT poll to hear
* about the connect completion
*/
-
- context->fds[wsi->position_in_fds_table].events |= POLLOUT;
-
- /* external POLL support via protocol 0 */
- context->protocols[0].callback(context, wsi,
- LWS_CALLBACK_SET_MODE_POLL_FD,
- wsi->user_space, (void *)(long)wsi->sock, POLLOUT);
+ lws_change_pollfd(wsi, 0, POLLOUT);
return wsi;
}