Skip to content
Snippets Groups Projects
  • Andy Green's avatar
    6f520a51
    evict all broadcast support · 6f520a51
    Andy Green authored
    
    Libwebsockets is fundamentally singlethreaded... the existence of the
    fork and broadcast support, especially in the sample server is
    giving the wrong idea about how to use it.
    
    This replaces broadcast in the sample server with
    libwebsocket_callback_on_writable_all_protocol().  The whole idea of
    'broadcast' is removed.
    
    All of the broadcast proxy stuff is removed: data must now be sent
    from the callback only.  Doing othherwise is not reliable since the
    service loop may close the socket and free the wsi at any time,
    invalidating a wsi pointer held by another thread (don't do that!)
    
    Likewise the confirm_legit_wsi api added recently does not help the
    other thread case, since if the wsi has been freed dereferencing the
    wsi to study if it is legit or not will segfault in that case.  So
    this is removed too.
    
    The overall effect is to push user code to only operate inside the
    protocol callbacks or external poll loops, ie, single thread context.
    
    Signed-off-by: default avatarAndy Green <andy.green@linaro.org>
    6f520a51
    History
    evict all broadcast support
    Andy Green authored
    
    Libwebsockets is fundamentally singlethreaded... the existence of the
    fork and broadcast support, especially in the sample server is
    giving the wrong idea about how to use it.
    
    This replaces broadcast in the sample server with
    libwebsocket_callback_on_writable_all_protocol().  The whole idea of
    'broadcast' is removed.
    
    All of the broadcast proxy stuff is removed: data must now be sent
    from the callback only.  Doing othherwise is not reliable since the
    service loop may close the socket and free the wsi at any time,
    invalidating a wsi pointer held by another thread (don't do that!)
    
    Likewise the confirm_legit_wsi api added recently does not help the
    other thread case, since if the wsi has been freed dereferencing the
    wsi to study if it is legit or not will segfault in that case.  So
    this is removed too.
    
    The overall effect is to push user code to only operate inside the
    protocol callbacks or external poll loops, ie, single thread context.
    
    Signed-off-by: default avatarAndy Green <andy.green@linaro.org>