diff options
Diffstat (limited to 'src/plugin.c')
-rw-r--r-- | src/plugin.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/plugin.c b/src/plugin.c index 1b54d81..c35d0d7 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -28,6 +28,7 @@ #include <arpa/inet.h> #include <assert.h> #include <errno.h> +#include <fcntl.h> #include <netinet/in.h> #include <poll.h> #include <stdlib.h> @@ -155,6 +156,8 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) } state->plugin_base = NULL; state->plugin_desc = &plugin_description; + state->max_value_size = DEFAULT_MAX_VALUE_SIZE; + state->max_dgram_size = DEFAULT_MAX_DGRAM_SIZE; slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &state->plugin_identity); slapi_pblock_get(pb, SLAPI_TARGET_DN, &state->plugin_base); @@ -175,7 +178,7 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) * listeners, over both IPv4 and IPv6. */ state->n_listeners = 0; for (i = 0; i < 2; i++) { - int pf, type, one, port, ret; + int pf, type, one, flags, port, ret; const char *sock_desc; /* Before we do anything else, on our second trip through, make * sure that the first socket was created, because we'll need @@ -202,7 +205,7 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) sock_desc); continue; } - /* Mark the socket as reusable. */ + /* Mark the socket as reusable and non-blocking. */ one = 1; if (setsockopt(sockfd, IPPROTO_IP, SO_REUSEADDR, &one, sizeof(one)) != 0) { @@ -211,7 +214,11 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) "error marking %s socket for reuse, " "continuing\n", sock_desc); } - /* Bind to a reserved port. */ + flags = fcntl(sockfd, F_GETFL); + if ((flags & O_NONBLOCK) == 0) { + fcntl(sockfd, F_SETFL, flags | O_NONBLOCK); + } + /* Bind to a reserved port, don't really care which one. */ memset(&sin, 0, sizeof(sin)); memset(&sin6, 0, sizeof(sin6)); sin.sin_family = AF_INET; |