aioquic icon indicating copy to clipboard operation
aioquic copied to clipboard

Issue with Connection migration while downloading file using example Client and Server

Open Karthikdasari0423 opened this issue 2 years ago • 2 comments

Hai @jlaine

Thank you for your contribution.

I am trying to download a file using client and server from examples folder.I was able to download file correctly. But whenever i have made some small change to client which will do connection migration in middle using multi-threading i was unable to continue the file download correctly and file was unable to download after connection migration.

Here is the code which i have made change

)
method = "POST"
else:

    async def conn_mig():
        print("sleep start")
        await asyncio.sleep(4)
        print("sleep done")
        client._transport.close()
        loop = asyncio.get_event_loop()
        #await loop.create_datagram_endpoint(lambda: client, local_addr=("::ffff:172.16.2.3", 4423), remote_addr=("::ffff:172.16.2.1",4433))
        await loop.create_datagram_endpoint(lambda: client, local_addr=("::", 0))
        #client.change_connection_id()
        import threading
        print(threading.current_thread().name)
        print(threading.get_ident())

    def send_thread():
        asyncio.run(conn_mig())

    def start_thread():
        import threading
        x = threading.Thread(target=send_thread)
        x.start()

    start_thread()

    import threading
    print(threading.current_thread().name)
    print(threading.get_ident())

    http_events = await client.get(url)
    method = "GET"



elapsed = time.time() - start

# print speed
octets = 0
for http_event in http_events:

I am unable to get what is the issue and could you please help me to sort out this issue @jlaine

Am i missing anything or Do i need to make changes on the server side too.

Looking forward for reply

Thank you.

Karthikdasari0423 avatar Jul 24 '22 13:07 Karthikdasari0423

Can we have a reproduction without threading, it's really unusual to use multi-threading in an asyncio project.

jlaine avatar Jul 28 '22 12:07 jlaine

Hai @jlaine

Thank you for replying back.

When I tried without multi-threading,then connection migration is successful happening just before start of file download or just after file download but not in the middle of file download.

Tried to do connection migration without multi threading in the middle of file download but it was not working.

Could you please suggest me any alternative way to do connection migration in the middle of file download without multi threading.

Looking forward for your reply.

Thank you.

Karthikdasari0423 avatar Jul 29 '22 06:07 Karthikdasari0423

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 27 '22 02:11 github-actions[bot]