]> git.meshlink.io Git - meshlink/commit
Handle meshlink_channel_close() being called in callbacks. fix/channel-close-in-callback
authorGuus Sliepen <guus@meshlink.io>
Fri, 8 May 2020 10:48:44 +0000 (12:48 +0200)
committerGuus Sliepen <guus@meshlink.io>
Fri, 8 May 2020 10:48:44 +0000 (12:48 +0200)
commit26fdd4fc9d2a2cc12b0118c3061a65ab3f3ee6c4
tree42cd230ebc0b1e9b6be589ecd61d6a8b4691d5bc
parent346af236de55f2039825eb6550bc0b662e6fc31b
Handle meshlink_channel_close() being called in callbacks.

When it's called in a callback, we can't free the channel until the
function that called the callback has a chance to safely complete. This
is not a problem for regular receive and poll callbacks, but it is for AIO,
where there can be multiple outstanding AIO buffers that each need their
callback called to signal completion, and each of them could potentially
call meshlink_channel_close().

This also ensures that when the channel is explicitly closed by the
application, it will not receive any further callbacks.
src/meshlink.c
src/meshlink_internal.h