Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: specify max named pipe instances #86

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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