and get a LWS_CALLBACK_HTTP_WRITEABLE callback, the same way you can
regulate writes with a websocket protocol connection.
+User api changes
+----------------
+
+ - the external poll callbacks now get the socket descriptor coming from the
+ "in" parameter. The user parameter provides the user_space for the
+ wsi as it normally does on the other callbacks.
+
+
v1.21-chrome26-firefox18
========================
/* external POLL support via protocol 0 */
context->protocols[0].callback(context, wsi,
LWS_CALLBACK_ADD_POLL_FD,
- (void *)(long)wsi->sock, NULL, POLLIN);
+ wsi->user_space, (void *)(long)wsi->sock, POLLIN);
return 0;
}
/* remove also from external POLL support via protocol 0 */
if (wsi->sock)
context->protocols[0].callback(context, wsi,
- LWS_CALLBACK_DEL_POLL_FD, (void *)(long)wsi->sock, NULL, 0);
+ LWS_CALLBACK_DEL_POLL_FD, wsi->user_space,
+ (void *)(long)wsi->sock, 0);
return 0;
}
/* external POLL support via protocol 0 */
context->protocols[0].callback(context, wsi,
LWS_CALLBACK_CLEAR_MODE_POLL_FD,
- (void *)(long)wsi->sock, NULL, POLLOUT);
+ wsi->user_space, (void *)(long)wsi->sock, POLLOUT);
}
#ifndef LWS_NO_EXTENSIONS
notify_action:
/* external POLL support via protocol 0 */
context->protocols[0].callback(context, wsi,
LWS_CALLBACK_SET_MODE_POLL_FD,
- (void *)(long)wsi->sock, NULL, POLLOUT);
+ wsi->user_space, (void *)(long)wsi->sock, POLLOUT);
return 1;
}
/* external POLL support via protocol 0 */
context->protocols[0].callback(context, wsi,
LWS_CALLBACK_SET_MODE_POLL_FD,
- (void *)(long)wsi->sock, NULL, POLLIN);
+ wsi->user_space, (void *)(long)wsi->sock, POLLIN);
else
/* external POLL support via protocol 0 */
context->protocols[0].callback(context, wsi,
LWS_CALLBACK_CLEAR_MODE_POLL_FD,
- (void *)(long)wsi->sock, NULL, POLLIN);
+ wsi->user_space, (void *)(long)wsi->sock, POLLIN);
return 1;
}
* poll array interface code in the callback for protocol 0, the
* first protocol you support, usually the HTTP protocol in the
* serving case. This callback happens when a socket needs to be
- * added to the polling loop: @user contains the fd, and
+ * added to the polling loop: @in contains the fd, and
* @len is the events bitmap (like, POLLIN). If you are using the
* internal polling loop (the "service" callback), you can just
* ignore these callbacks.
*
* LWS_CALLBACK_DEL_POLL_FD: This callback happens when a socket descriptor
- * needs to be removed from an external polling array. @user is
+ * needs to be removed from an external polling array. @in is
* the socket desricptor. If you are using the internal polling
* loop, you can just ignore it.
*
* LWS_CALLBACK_SET_MODE_POLL_FD: This callback happens when libwebsockets
- * wants to modify the events for the socket descriptor in @user.
+ * wants to modify the events for the socket descriptor in @in.
* The handler should OR @len on to the events member of the pollfd
* struct for this socket descriptor. If you are using the
* internal polling loop, you can just ignore it.
*
* LWS_CALLBACK_CLEAR_MODE_POLL_FD: This callback occurs when libwebsockets
- * wants to modify the events for the socket descriptor in @user.
+ * wants to modify the events for the socket descriptor in @in.
* The handler should AND ~@len on to the events member of the
* pollfd struct for this socket descriptor. If you are using the
* internal polling loop, you can just ignore it.
</blockquote>
<h3>added to the polling loop</h3>
<blockquote>
-<tt><b>user</b></tt> contains the fd, and
+<tt><b>in</b></tt> contains the fd, and
<tt><b>len</b></tt> is the events bitmap (like, POLLIN). If you are using the
internal polling loop (the "service" callback), you can just
ignore these callbacks.
<h3>LWS_CALLBACK_DEL_POLL_FD</h3>
<blockquote>
This callback happens when a socket descriptor
-needs to be removed from an external polling array. <tt><b>user</b></tt> is
+needs to be removed from an external polling array. <tt><b>in</b></tt> is
the socket desricptor. If you are using the internal polling
loop, you can just ignore it.
</blockquote>
<h3>LWS_CALLBACK_SET_MODE_POLL_FD</h3>
<blockquote>
This callback happens when libwebsockets
-wants to modify the events for the socket descriptor in <tt><b>user</b></tt>.
+wants to modify the events for the socket descriptor in <tt><b>in</b></tt>.
The handler should OR <tt><b>len</b></tt> on to the events member of the pollfd
struct for this socket descriptor. If you are using the
internal polling loop, you can just ignore it.
<h3>LWS_CALLBACK_CLEAR_MODE_POLL_FD</h3>
<blockquote>
This callback occurs when libwebsockets
-wants to modify the events for the socket descriptor in <tt><b>user</b></tt>.
+wants to modify the events for the socket descriptor in <tt><b>in</b></tt>.
The handler should AND ~<tt><b>len</b></tt> on to the events member of the
pollfd struct for this socket descriptor. If you are using the
internal polling loop, you can just ignore it.
struct per_session_data__http *pss = (struct per_session_data__http *)user;
#ifdef EXTERNAL_POLL
int m;
- int fd = (int)(long)user;
+ int fd = (int)(long)in;
#endif
switch (reason) {