diff options
author | milo <milo@r0ot.me> | 2011-02-20 14:06:19 +0100 |
---|---|---|
committer | milo <milo@r0ot.me> | 2011-02-20 14:37:34 +0100 |
commit | e40261c22ce8630558fdadf2932f472793528a1b (patch) | |
tree | 265400ed205e03bfd3a9080d1a772f74dc6db33c /src | |
parent | 6582da1d67ca85a1efd67c4d751295a7a818d34e (diff) | |
download | libssh-e40261c22ce8630558fdadf2932f472793528a1b.tar.gz libssh-e40261c22ce8630558fdadf2932f472793528a1b.tar.xz libssh-e40261c22ce8630558fdadf2932f472793528a1b.zip |
poll: Added function to remove fd from the event context.
Diffstat (limited to 'src')
-rw-r--r-- | src/poll.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -836,6 +836,36 @@ int ssh_event_add_session(ssh_event event, ssh_session session) { } /** + * @brief Remove a socket fd from an event context. + * + * @param event The ssh_event object. + * @param fd The fd to remove. + * + * @returns SSH_OK on success + * SSH_ERROR on failure + */ +int ssh_event_remove_fd(ssh_event event, socket_t fd) { + ssh_poll_handle p; + register size_t i, used; + int rc = SSH_ERROR; + + if(event == NULL || event->ctx == NULL) { + return SSH_ERROR; + } + + used = event->ctx->polls_used; + for (i = 0; i < used; i++) { + if(fd == event->ctx->pollfds[i].fd) { + p = event->ctx->pollptrs[i]; + ssh_poll_ctx_remove(event->ctx, p); + rc = SSH_OK; + } + } + + return rc; +} + +/** * @brief Remove a session object from an event context. * * @param event The ssh_event object. |