Skip to content

Commit

Permalink
Read until EOF for request recv
Browse files Browse the repository at this point in the history
  • Loading branch information
lgaan committed Nov 1, 2020
1 parent 6ee7ae1 commit ac27545
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions discord/ext/ipc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def __init__(self, bot, host, port, secret_key):

self.secret_key = secret_key

self.multicast_grp = socket.gethostbyname(socket.gethostname())
try:
self.multicast_grp = socket.gethostbyname(socket.gethostname())
except socket.gaierror:
self.multicast_grp = socket.gethostbyname("0.0.0.0")

def route(self, name=None):
"""Used to register a coroutine as an endpoint"""
Expand Down Expand Up @@ -86,7 +89,13 @@ def client_cleanup(future):
async def client_task(self, reader, writer):
"""Processes the client request"""
while True:
data = await reader.read(1024)
data = b""
while True:
while not reader.at_eof():
data += await reader.read(100)
reader.feed_eof()

break

if data == b"":
return
Expand Down

0 comments on commit ac27545

Please sign in to comment.