smallnest / rpcx

Best microservices framework in Go, like alibaba Dubbo, but with more features, Scale easily. Try it. Test it. If you feel it's better, use it! 𝐉𝐚𝐯𝐚有𝐝𝐮𝐛𝐛𝐨, 𝐆𝐨𝐥𝐚𝐧𝐠有𝐫𝐩𝐜𝐱! build for cloud!
https://rpcx.io
Other
8.11k stars 1.17k forks source link

fix: break an infinite loop on file transfer #830

Closed Inspirate789 closed 11 months ago

Inspirate789 commented 11 months ago

A common situation: I want to send a file with timeout.

If the time to send the file expires, ctx.Done() is called. In this case SendFile(...) and DownloadFile(...) functions go into an infinite loop, which cannot be interrupted from outside. I have made correct termination of file transfer in case of ctx.Done().