portal 3.1.4__tar.gz → 3.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {portal-3.1.4/portal.egg-info → portal-3.1.5}/PKG-INFO +1 -1
- {portal-3.1.4 → portal-3.1.5}/portal/__init__.py +1 -1
- {portal-3.1.4 → portal-3.1.5}/portal/client_socket.py +5 -10
- {portal-3.1.4 → portal-3.1.5}/portal/contextlib.py +1 -0
- {portal-3.1.4 → portal-3.1.5}/portal/server_socket.py +1 -0
- {portal-3.1.4 → portal-3.1.5/portal.egg-info}/PKG-INFO +1 -1
- {portal-3.1.4 → portal-3.1.5}/LICENSE +0 -0
- {portal-3.1.4 → portal-3.1.5}/MANIFEST.in +0 -0
- {portal-3.1.4 → portal-3.1.5}/README.md +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal/batching.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal/buffers.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal/client.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal/packlib.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal/poollib.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal/process.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal/server.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal/sharray.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal/thread.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal/utils.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal.egg-info/SOURCES.txt +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal.egg-info/dependency_links.txt +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal.egg-info/requires.txt +0 -0
- {portal-3.1.4 → portal-3.1.5}/portal.egg-info/top_level.txt +0 -0
- {portal-3.1.4 → portal-3.1.5}/pyproject.toml +0 -0
- {portal-3.1.4 → portal-3.1.5}/requirements.txt +0 -0
- {portal-3.1.4 → portal-3.1.5}/setup.cfg +0 -0
- {portal-3.1.4 → portal-3.1.5}/setup.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/tests/test_batching.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/tests/test_client.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/tests/test_errfile.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/tests/test_pack.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/tests/test_process.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/tests/test_server.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/tests/test_socket.py +0 -0
- {portal-3.1.4 → portal-3.1.5}/tests/test_thread.py +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
import collections
|
2
2
|
import dataclasses
|
3
3
|
import queue
|
4
|
-
import
|
4
|
+
import select
|
5
5
|
import socket
|
6
6
|
import sys
|
7
7
|
import threading
|
@@ -109,7 +109,6 @@ class ClientSocket:
|
|
109
109
|
|
110
110
|
def _loop(self):
|
111
111
|
recvbuf = buffers.RecvBuffer(maxsize=self.options.max_msg_size)
|
112
|
-
sel = selectors.DefaultSelector()
|
113
112
|
sock = None
|
114
113
|
isconn = False # Local mirror of self.isconn without the lock.
|
115
114
|
|
@@ -121,7 +120,6 @@ class ClientSocket:
|
|
121
120
|
sock = self._connect()
|
122
121
|
if not sock:
|
123
122
|
break
|
124
|
-
sel.register(sock, selectors.EVENT_READ | selectors.EVENT_WRITE)
|
125
123
|
self.isconn.set()
|
126
124
|
isconn = True
|
127
125
|
if not self.options.autoconn:
|
@@ -130,12 +128,9 @@ class ClientSocket:
|
|
130
128
|
|
131
129
|
try:
|
132
130
|
|
133
|
-
|
134
|
-
if not ready:
|
135
|
-
continue
|
136
|
-
_, mask = ready[0]
|
131
|
+
readable, writable, _ = select.select([sock], [sock], [], 0.2)
|
137
132
|
|
138
|
-
if
|
133
|
+
if readable:
|
139
134
|
try:
|
140
135
|
recvbuf.recv(sock)
|
141
136
|
if recvbuf.done():
|
@@ -148,7 +143,7 @@ class ClientSocket:
|
|
148
143
|
except BlockingIOError:
|
149
144
|
pass
|
150
145
|
|
151
|
-
if self.sendq and
|
146
|
+
if self.sendq and writable:
|
152
147
|
try:
|
153
148
|
self.sendq[0].send(sock)
|
154
149
|
if self.sendq[0].done():
|
@@ -162,7 +157,6 @@ class ClientSocket:
|
|
162
157
|
self._log(f'Connection to server lost ({detail})')
|
163
158
|
self.isconn.clear()
|
164
159
|
isconn = False
|
165
|
-
sel.unregister(sock)
|
166
160
|
sock.close()
|
167
161
|
# Clear message queue on disconnect. There is no meaningful concept of
|
168
162
|
# sucessful delivery of a message at this level. For example, the
|
@@ -213,6 +207,7 @@ class ClientSocket:
|
|
213
207
|
else:
|
214
208
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
215
209
|
addr = self.addr
|
210
|
+
# sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
216
211
|
after = self.options.keepalive_after
|
217
212
|
every = self.options.keepalive_every
|
218
213
|
fails = self.options.keepalive_fails
|
@@ -47,6 +47,7 @@ class ServerSocket:
|
|
47
47
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
48
48
|
self.addr = (self.options.host, port)
|
49
49
|
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
50
|
+
# self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
50
51
|
self.sock.bind(self.addr)
|
51
52
|
self.sock.setblocking(False)
|
52
53
|
self.sock.listen()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|