void
SCK_Finalise(void)
{
- int fd;
-
ARR_DestroyInstance(recv_sck_messages);
ARR_DestroyInstance(recv_headers);
ARR_DestroyInstance(recv_messages);
- for (fd = first_reusable_fd; fd < first_reusable_fd + reusable_fds; fd++)
- close(fd);
- reusable_fds = 0;
- first_reusable_fd = 0;
+ SCK_CloseReusableSockets();
initialised = 0;
}
/* ================================================== */
+void
+SCK_CloseReusableSockets(void)
+{
+ int fd;
+
+ for (fd = first_reusable_fd; fd < first_reusable_fd + reusable_fds; fd++)
+ close(fd);
+ reusable_fds = 0;
+ first_reusable_fd = 0;
+}
+
+/* ================================================== */
+
int
SCK_SetIntOption(int sock_fd, int level, int name, int value)
{
/* Check if a file descriptor was passed from the service manager */
extern int SCK_IsReusable(int sock_fd);
+/* Close all reusable sockets before finalisation (e.g. in a helper process) */
+extern void SCK_CloseReusableSockets(void);
+
/* Set and get a socket option of int size */
extern int SCK_SetIntOption(int sock_fd, int level, int name, int value);
extern int SCK_GetIntOption(int sock_fd, int level, int name, int *value);