Closed kjyrinki-unikie closed 8 months ago
I think this is a good start, but can we solve this problem by creating a new method called recv_raw
for the Socket
trait, which is just recv
for the UdpSocket
, but on ServerSocket
, uses the internal UdpSocket
to get the data? This way we can put recv_raw
inside the check_response
function, and it will use the provided Socket
to get the data for each case.
Not 100% sure if I got your idea, but I think approach you proposed might have issue in single port case if some other client tries to connect while the check_response() is waiting the ACK for OACK from the previous client in this new recv.
When running tftpd with -s single port argument and Read Request with options are provided ACK for OACK is not properly received.
The problem is that code is waiting MPSC channel response, but there is no thread for receiving data from UDP socket and MPSC receive will timeout.
Fix is to move waiting of ACK response for OACK into worker thread in the beginning of file sending. I.e. File send is started with receiving ACK when there were options and OACK was sent in the accept_request().
Fixes issue #16