diff --git a/src/openjd/adaptor_runtime/_background/server_config.py b/src/openjd/adaptor_runtime/_background/server_config.py index beea6d4..c12fe2e 100644 --- a/src/openjd/adaptor_runtime/_background/server_config.py +++ b/src/openjd/adaptor_runtime/_background/server_config.py @@ -3,3 +3,6 @@ # Windows Named Pipe Server Configuration NAMED_PIPE_BUFFER_SIZE = 8192 DEFAULT_NAMED_PIPE_TIMEOUT_MILLISECONDS = 5000 +# This number must be >= 2, one instance is for normal operation communication +# and the other one is for immediate shutdown communication +DEFAULT_MAX_NAMED_PIPE_INSTANCES = 2 diff --git a/src/openjd/adaptor_runtime/_named_pipe/named_pipe_helper.py b/src/openjd/adaptor_runtime/_named_pipe/named_pipe_helper.py index 1b908a1..41bbfc1 100644 --- a/src/openjd/adaptor_runtime/_named_pipe/named_pipe_helper.py +++ b/src/openjd/adaptor_runtime/_named_pipe/named_pipe_helper.py @@ -19,7 +19,10 @@ import os -from openjd.adaptor_runtime._background.server_config import NAMED_PIPE_BUFFER_SIZE +from openjd.adaptor_runtime._background.server_config import ( + NAMED_PIPE_BUFFER_SIZE, + DEFAULT_MAX_NAMED_PIPE_INSTANCES, +) _logger = logging.getLogger(__name__) @@ -181,7 +184,7 @@ def create_named_pipe_server(pipe_name: str, time_out_in_seconds: float) -> Opti # A bi-directional pipe; both server and client processes can read from and write to the pipe. win32pipe.PIPE_ACCESS_DUPLEX, win32pipe.PIPE_TYPE_MESSAGE | win32pipe.PIPE_READMODE_MESSAGE | win32pipe.PIPE_WAIT, - win32pipe.PIPE_UNLIMITED_INSTANCES, + DEFAULT_MAX_NAMED_PIPE_INSTANCES, NAMED_PIPE_BUFFER_SIZE, # nOutBufferSize NAMED_PIPE_BUFFER_SIZE, # nInBufferSize time_out_in_seconds,