From ab6e6823b628af93e1f5d95ab1677e8843d913af Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 25 Jun 2014 23:07:33 +0200 Subject: [PATCH] client: Added sdb_client_shutdown(). --- src/client/sock.c | 16 ++++++++++++++++ src/include/client/sock.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/src/client/sock.c b/src/client/sock.c index 805dc1d..b60bad4 100644 --- a/src/client/sock.c +++ b/src/client/sock.c @@ -211,6 +211,22 @@ sdb_client_sockfd(sdb_client_t *client) return client->fd; } /* sdb_client_sockfd */ +int +sdb_client_shutdown(sdb_client_t *client, int how) +{ + if (! client) { + errno = ENOTSOCK; + return -1; + } + + if (client->fd < 0) { + errno = EBADF; + return -1; + } + + return shutdown(client->fd, how); +} /* sdb_client_shutdown */ + void sdb_client_close(sdb_client_t *client) { diff --git a/src/include/client/sock.h b/src/include/client/sock.h index bce3da9..aeed8a2 100644 --- a/src/include/client/sock.h +++ b/src/include/client/sock.h @@ -83,6 +83,14 @@ sdb_client_connect(sdb_client_t *client, const char *username); int sdb_client_sockfd(sdb_client_t *client); +/* + * sdb_client_shutdown: + * Shut down the client's send and/or receive operations. + * See shutdown(3) for details. + */ +int +sdb_client_shutdown(sdb_client_t *client, int how); + /* * sdb_client_close: * Close the client connection. -- 2.30.2