Skip to content

Commit

Permalink
fix: specify max named pipe instances (#86)
Browse files Browse the repository at this point in the history
Signed-off-by: Hongli Chen <honglich@amazon.com>
  • Loading branch information
Honglichenn committed Mar 15, 2024
1 parent 3b44abd commit d959381
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/openjd/adaptor_runtime/_background/server_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 5 additions & 2 deletions src/openjd/adaptor_runtime/_named_pipe/named_pipe_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d959381

Please sign in to comment.