Skip to content

Commit

Permalink
fixing TIME_WAIT on the ext-server socket
Browse files Browse the repository at this point in the history
SO_REUSEADDR is set for the new socket; alternative would be to wait for client
side to close its end, but misbehaving client would be able to block the server
in such case.

Signed-off-by: Martin Volf <mvolf@cisco.com>
  • Loading branch information
martin-volf committed Dec 18, 2023
1 parent b10df28 commit 5c53314
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/confd_gnmi_api_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import threading
import json
from enum import Enum
from socket import socket
from socket import create_server, socket
import gnmi_pb2
from confd_gnmi_adapter import GnmiServerAdapter
from confd_gnmi_api_adapter_defaults import ApiAdapterDefaults
Expand Down Expand Up @@ -317,10 +317,9 @@ def start_external_change_server():
"""
log.debug("==>")
log.info("Starting external change server!")
ext_server_sock = socket()
# TODO port (host) as const or command line option
ext_server_sock.bind(("localhost",
GnmiConfDApiServerAdapter.external_port))
ext_server_sock = create_server(("localhost", GnmiConfDApiServerAdapter.external_port),
reuse_port=True)
ext_server_sock.listen(5)
log.debug("<== ext_server_sock=%s", ext_server_sock)
return ext_server_sock
Expand Down

0 comments on commit 5c53314

Please sign in to comment.