stream: Make sure no watcher callback is active while changing stream callbacks
authorMartin Willi <martin@revosec.ch>
Tue, 21 Jan 2014 16:36:38 +0000 (17:36 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 22 Jan 2014 14:34:53 +0000 (15:34 +0100)
commite49b299867989bbad677c9cc86c1e9be80d8ca2a
tree1b8fe3d45e4b3e97929a31b1c45aa837fb74601e
parenta40c66194ed82fa7c752c9fa5528d31692f6024a
stream: Make sure no watcher callback is active while changing stream callbacks

When changing async callbacks on streams, we have to make sure the watcher
callback is not currently active and has temporarily disabled callbacks. This
could have been the case, as we didn't explicitly removed any pending
watcher registration if both callbacks are NULL.

By enforcing the watcher unregistration, we are sure the watcher callback is
not active and currently is not mangling the callback hooks. This should make
sure we avoid any races for the callback variables.
src/libstrongswan/networking/streams/stream.c