Code

client: Added sdb_client_shutdown().
authorSebastian Harl <sh@tokkee.org>
Wed, 25 Jun 2014 21:07:33 +0000 (23:07 +0200)
committerSebastian Harl <sh@tokkee.org>
Wed, 25 Jun 2014 21:07:33 +0000 (23:07 +0200)
src/client/sock.c
src/include/client/sock.h

index 805dc1d1ce5350da8d1aaced43d9bce53df1d9cd..b60bad45e2cf97d47d2c101513c030f4a27fff5e 100644 (file)
@@ -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)
 {
index bce3da91898a670a00eb532e630e2b0663462321..aeed8a253b58f310c4e3e55df13e38f4bfa0232b 100644 (file)
@@ -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.