Skip to content

Commit e9f7879

Browse files
committed
Update comments
1 parent 77bf1ed commit e9f7879

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

unpythonic/net/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ def complete(text, state):
3333
try:
3434
request = {"text": text, "state": state}
3535
data_out = json.dumps(request).encode("utf-8")
36-
# TODO: race condition. We should ensure we don't read partial messages.
37-
# See https://docs.python.org/3/howto/sockets.html for how to handle socket data transfers properly. It's a bit complicated.
3836
sock.sendall(data_out)
37+
# TODO: must know how to receive until end of message, since TCP doesn't do datagrams
38+
# TODO: build a control channel protocol
39+
# https://docs.python.org/3/howto/sockets.html
3940
data_in = sock.recv(4096).decode("utf-8")
4041
# print("text '{}' state '{}' reply '{}'".format(text, state, data_in))
4142
if not data_in:

unpythonic/net/server.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ class ClientExit(Exception):
153153
while True:
154154
rs, ws, es = select.select([sock], [], [])
155155
for r in rs:
156+
# TODO: must know how to receive until end of message, since TCP doesn't do datagrams
157+
# TODO: build a control channel protocol
158+
# https://docs.python.org/3/howto/sockets.html
156159
data_in = sock.recv(4096).decode("utf-8")
157160
if len(data_in) == 0: # EOF on network socket
158161
raise ClientExit

0 commit comments

Comments
 (0)