[Libwebsockets] API change / no feature test

Andy Green andy at warmcat.com
Tue Sep 2 00:29:48 CEST 2014

On 2 September 2014 03:24:41 GMT+08:00, Michael Haberler <mail17 at mah.priv.at> wrote:
>Hi Andy,
>the libwebsocket_protocols struct changed in
>unfortunately this changes the position of the id field, and hence
>breaks its initialisation:
>- *             got send yourself.
>* @id:                ignored by lws, but useful to contain user
>information bound
>*             to the selected protocol.  For example if this protocol
>*             called "myprotocol-v2", you might set id to 2, and the
>@@ -890,7 +882,6 @@ struct libwebsocket_protocols {
>        callback_function *callback;
>        size_t per_session_data_size;
>        size_t rx_buffer_size;
>-       int no_buffer_all_partial_tx;
>        unsigned int id;
>I guess we need a feature test in one way or the other to make existing
>using code compile?

It should be fine using either

 - dynamic struct alloc like info: memset the struct to 0 and set the members you cared about

 - static struct alloc: use C99-style static struct initializer (.member = value)

This removed member isn't one the code should care about, its function was broken for a long time and it should be fine to leave it at 0.

If there is someone who needs it at 1, yes, the feature flag would be needed.  But for 0, one of the above methods will do it if it exists and not break if it doesn't.


>- Michael
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org

More information about the Libwebsockets mailing list