From de986871fad51b69ccfc30c97a132e8cf45d94a7 Mon Sep 17 00:00:00 2001 From: Sree Harsha Totakura Date: Fri, 6 Apr 2012 07:46:24 +0000 Subject: [PATCH] -shutdown completion callback --- src/include/gnunet_stream_lib.h | 20 ++++++++++++++++++-- src/stream/stream_api.c | 11 ++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/include/gnunet_stream_lib.h b/src/include/gnunet_stream_lib.h index a16d052d6..4a574dfe4 100644 --- a/src/include/gnunet_stream_lib.h +++ b/src/include/gnunet_stream_lib.h @@ -130,16 +130,32 @@ GNUNET_STREAM_open (const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_STREAM_ShutdownHandle; +/** + * Completion callback for shutdown + * + * @param cls the closure from GNUNET_STREAM_shutdown call + * @param operation the operation that was shutdown (SHUT_RD, SHUT_WR, + * SHUT_RDWR) + */ +typedef void (*GNUNET_STREAM_ShutdownCompletion) (void *cls, + int operation); + + /** * Shutdown the stream for reading or writing (man 2 shutdown). * * @param socket the stream socket - * @param how SHUT_RD, SHUT_WR or SHUT_RDWR + * @param opertion SHUT_RD, SHUT_WR or SHUT_RDWR + * @param completion_cb the callback that will be called upon successful + * shutdown of given operation + * @param completion_cls the closure for the completion callback * @return the shutdown handle */ struct GNUNET_STREAM_ShutdownHandle * GNUNET_STREAM_shutdown (struct GNUNET_STREAM_Socket *socket, - int how); + int operation, + GNUNET_STREAM_ShutdownCompletion completion_cb, + void *completion_cls); /** diff --git a/src/stream/stream_api.c b/src/stream/stream_api.c index 2180f919a..93d9c9fe2 100644 --- a/src/stream/stream_api.c +++ b/src/stream/stream_api.c @@ -2370,15 +2370,20 @@ GNUNET_STREAM_open (const struct GNUNET_CONFIGURATION_Handle *cfg, /** - * Shutdown the stream for reading or writing (man 2 shutdown). + * Shutdown the stream for reading or writing (similar to man 2 shutdown). * * @param socket the stream socket - * @param how SHUT_RD, SHUT_WR or SHUT_RDWR + * @param opertion SHUT_RD, SHUT_WR or SHUT_RDWR + * @param completion_cb the callback that will be called upon successful + * shutdown of given operation + * @param completion_cls the closure for the completion callback * @return the shutdown handle */ struct GNUNET_STREAM_ShutdownHandle * GNUNET_STREAM_shutdown (struct GNUNET_STREAM_Socket *socket, - int how) + int operation, + GNUNET_STREAM_ShutdownCompletion completion_cb, + void *completion_cls) { return NULL; } -- 2.25.1