[ https://issues.apache.org/jira/browse/THRIFT-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16695904#comment-16695904 ]
ASF GitHub Bot commented on THRIFT-4668: ---------------------------------------- jeking3 closed pull request #1631: THRIFT-4668: make socket backlog configurable for python URL: https://github.com/apache/thrift/pull/1631 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/lib/py/src/transport/TSocket.py b/lib/py/src/transport/TSocket.py index c91de9d701..a7d661703d 100644 --- a/lib/py/src/transport/TSocket.py +++ b/lib/py/src/transport/TSocket.py @@ -159,6 +159,15 @@ def __init__(self, host=None, port=9090, unix_socket=None, socket_family=socket. self._unix_socket = unix_socket self._socket_family = socket_family self.handle = None + self._backlog = 128 + + def setBacklog(self, backlog=None): + if not self.handle: + self._backlog = backlog + else: + # We cann't update backlog when it is already listening, since the + # handle has been created. + logger.warn('You have to set backlog before listen.') def listen(self): res0 = self._resolveAddr() @@ -183,7 +192,7 @@ def listen(self): if hasattr(self.handle, 'settimeout'): self.handle.settimeout(None) self.handle.bind(res[4]) - self.handle.listen(128) + self.handle.listen(self._backlog) def accept(self): client, addr = self.handle.accept() ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > make socket backlog configurable for python > ------------------------------------------- > > Key: THRIFT-4668 > URL: https://issues.apache.org/jira/browse/THRIFT-4668 > Project: Thrift > Issue Type: Improvement > Components: Python - Library > Affects Versions: 0.11.0 > Reporter: lsh > Priority: Minor > Labels: patch > > The backlog parameter of socket.listen was hard coded, so I can't customize > it in my code. > Adding `setBacklog` to `TServerSocket` can resolve my problem. :) -- This message was sent by Atlassian JIRA (v7.6.3#76005)