diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2014-03-11 20:48:48 +0100 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2014-03-11 20:48:48 +0100 |
commit | b96bc2fcc06cc6c1762dc193a5117ebcb956e220 (patch) | |
tree | 4915ecb47936524433c6578526cc5d25a0d2913c /src/libstrongswan/networking/streams | |
parent | 4a7efb286aaf809849d56841b59c2d733e8dff49 (diff) | |
parent | 15fb7904f4431a6e7c305fd08732458f7f885e7e (diff) | |
download | vyos-strongswan-b96bc2fcc06cc6c1762dc193a5117ebcb956e220.tar.gz vyos-strongswan-b96bc2fcc06cc6c1762dc193a5117ebcb956e220.zip |
Merge tag 'upstream/5.1.2'
Upstream version 5.1.2
Diffstat (limited to 'src/libstrongswan/networking/streams')
-rw-r--r-- | src/libstrongswan/networking/streams/stream.c | 17 | ||||
-rw-r--r-- | src/libstrongswan/networking/streams/stream.h | 5 |
2 files changed, 5 insertions, 17 deletions
diff --git a/src/libstrongswan/networking/streams/stream.c b/src/libstrongswan/networking/streams/stream.c index 8ecb89fc9..f6fec0b4a 100644 --- a/src/libstrongswan/networking/streams/stream.c +++ b/src/libstrongswan/networking/streams/stream.c @@ -159,17 +159,6 @@ METHOD(stream_t, write_all, bool, } /** - * Remove a registered watcher - */ -static void remove_watcher(private_stream_t *this) -{ - if (this->read_cb || this->write_cb) - { - lib->watcher->remove(lib->watcher, this->fd); - } -} - -/** * Watcher callback */ static bool watch(private_stream_t *this, int fd, watcher_event_t event) @@ -228,7 +217,7 @@ static void add_watcher(private_stream_t *this) METHOD(stream_t, on_read, void, private_stream_t *this, stream_cb_t cb, void *data) { - remove_watcher(this); + lib->watcher->remove(lib->watcher, this->fd); this->read_cb = cb; this->read_data = data; @@ -239,7 +228,7 @@ METHOD(stream_t, on_read, void, METHOD(stream_t, on_write, void, private_stream_t *this, stream_cb_t cb, void *data) { - remove_watcher(this); + lib->watcher->remove(lib->watcher, this->fd); this->write_cb = cb; this->write_data = data; @@ -270,7 +259,7 @@ METHOD(stream_t, get_file, FILE*, METHOD(stream_t, destroy, void, private_stream_t *this) { - remove_watcher(this); + lib->watcher->remove(lib->watcher, this->fd); close(this->fd); free(this); } diff --git a/src/libstrongswan/networking/streams/stream.h b/src/libstrongswan/networking/streams/stream.h index 810514da9..3516d9186 100644 --- a/src/libstrongswan/networking/streams/stream.h +++ b/src/libstrongswan/networking/streams/stream.h @@ -39,9 +39,8 @@ typedef stream_t*(*stream_constructor_t)(char *uri); /** * Callback function prototype, called when stream is ready. * - * It is allowed to destroy the stream during the callback, but only if it has - * no other active on_read()/on_write() callback and returns FALSE. It is not - * allowed to to call on_read()/on_write/() during the callback. + * It is not allowed to destroy the stream nor to call on_read()/on_write/() + * during the callback. * * As select() may return even if a read()/write() would actually block, it is * recommended to use the non-blocking calls and handle return values |