aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-registry
diff options
context:
space:
mode:
Diffstat (limited to 'src/mds-registry')
-rw-r--r--src/mds-registry/mds-registry.c12
-rw-r--r--src/mds-registry/registry.c11
-rw-r--r--src/mds-registry/util.c31
-rw-r--r--src/mds-registry/util.h9
4 files changed, 23 insertions, 40 deletions
diff --git a/src/mds-registry/mds-registry.c b/src/mds-registry/mds-registry.c
index a9af91d..df3db51 100644
--- a/src/mds-registry/mds-registry.c
+++ b/src/mds-registry/mds-registry.c
@@ -21,6 +21,7 @@
#include "globals.h"
#include "registry.h"
+#include <libmdsserver/util.h>
#include <libmdsserver/macros.h>
#include <libmdsserver/hash-help.h>
#include <libmdsserver/linked-list.h>
@@ -50,6 +51,17 @@ server_characteristics_t server_characteristics =
/**
+ * Send a full message even if interrupted
+ *
+ * @param message:const char* The message to send
+ * @param length:size_t The length of the message
+ * @return :int Zero on success, -1 on error
+ */
+#define full_send(message, length) \
+ ((full_send)(socket_fd, message, length))
+
+
+/**
* This function will be invoked before `initialise_server` (if not re-exec:ing)
* or before `unmarshal_server` (if re-exec:ing)
*
diff --git a/src/mds-registry/registry.c b/src/mds-registry/registry.c
index 660fd6c..359bfc3 100644
--- a/src/mds-registry/registry.c
+++ b/src/mds-registry/registry.c
@@ -38,6 +38,17 @@
/**
+ * Send a full message even if interrupted
+ *
+ * @param message:const char* The message to send
+ * @param length:size_t The length of the message
+ * @return :int Zero on success, -1 on error
+ */
+#define full_send(message, length) \
+ ((full_send)(socket_fd, message, length))
+
+
+/**
* Handle the received message containing a ‘Client closed’-header
*
* @return Zero on success -1 on error or interruption,
diff --git a/src/mds-registry/util.c b/src/mds-registry/util.c
index 551904a..1debaa3 100644
--- a/src/mds-registry/util.c
+++ b/src/mds-registry/util.c
@@ -56,34 +56,3 @@ void reg_table_free_value(size_t obj)
free(list);
}
-
-/**
- * Send a full message even if interrupted
- *
- * @param message The message to send
- * @param length The length of the message
- * @return Zero on success, -1 on error
- */
-int full_send(const char* message, size_t length)
-{
- size_t sent;
-
- while (length > 0)
- {
- sent = send_message(socket_fd, message, length);
- if (sent > length)
- {
- eprint("Sent more of a message than exists in the message, aborting.");
- return -1;
- }
- else
- fail_if ((sent < length) && (errno != EINTR));
- message += sent;
- length -= sent;
- }
- return 0;
- fail:
- xperror(*argv);
- return -1;
-}
-
diff --git a/src/mds-registry/util.h b/src/mds-registry/util.h
index ea0d492..5699a98 100644
--- a/src/mds-registry/util.h
+++ b/src/mds-registry/util.h
@@ -36,15 +36,6 @@ void reg_table_free_key(size_t obj);
*/
void reg_table_free_value(size_t obj);
-/**
- * Send a full message even if interrupted
- *
- * @param message The message to send
- * @param length The length of the message
- * @return Zero on success, -1 on error
- */
-int full_send(const char* message, size_t length);
-
#endif