#include <sys/stat.h>
#endif /* HAVE_SYS_STAT_H */
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <setjmp.h>
#include <time.h>
#include "uid.h"
#endif /* FORCE_UIDGID */
+#ifndef SOL_TCP
+#define SOL_TCP IPPROTO_TCP
+#endif
+
/*
* We generally pass this from afp_over_dsi to all afp_* funcs, so it should already be
* available everywhere. Unfortunately some funcs (eg acltoownermode) need acces to it
static void afp_dsi_close(AFPObj *obj)
{
DSI *dsi = obj->handle;
-
+ sigset_t sigs;
+
close(obj->ipc_fd);
obj->ipc_fd = -1;
}
close_all_vol();
- if (obj->logout)
+
+ if (obj->logout) {
+ /* Block sigs, PAM/systemd/whoever might send us a SIG??? in (*obj->logout)() -> pam_close_session() */
+ sigfillset(&sigs);
+ pthread_sigmask(SIG_BLOCK, &sigs, NULL);
(*obj->logout)();
+ }
LOG(log_note, logtype_afpd, "AFP statistics: %.2f KB read, %.2f KB written",
dsi->read_count/1024.0, dsi->write_count/1024.0);
struct sigaction action;
AFPobj = obj;
- dsi->AFPobj = obj;
obj->exit = afp_dsi_die;
obj->reply = (int (*)()) dsi_cmdreply;
obj->attention = (int (*)(void *, AFPUserBytes)) dsi_attention;
}
}
+ /* set TCP_NODELAY */
+ int flag = 1;
+ setsockopt(dsi->socket, SOL_TCP, TCP_NODELAY, &flag, sizeof(flag));
+
/* get stuck here until the end */
while (1) {
if (sigsetjmp(recon_jmp, 1) != 0)