handlersocket must be bound before calling select()

this is due to a rather odd (imo) decision in luasocket which
says that the underlying socket (and therefore its file
descriptor) isn't actually created until we call something
that lets it work out whether ipv4 or ipv6
This commit is contained in:
Daniel Barlow 2023-02-15 20:42:37 +00:00
parent 2388e4ca24
commit b438a0fd17

View file

@ -301,6 +301,7 @@ function tftp:listen(rrq_generator_callback, wrq_generator_callback, hosts, port
if request.opcode == 'WRQ' then requestsocket:sendto(self.ACK(0), host, port) end if request.opcode == 'WRQ' then requestsocket:sendto(self.ACK(0), host, port) end
end end
local handlersocket = UDPSocket() local handlersocket = UDPSocket()
handlersocket:bind("*", 0)
local handler = self['handle_' .. request.opcode](self, handlersocket, host, port, generator, request.options) local handler = self['handle_' .. request.opcode](self, handlersocket, host, port, generator, request.options)
return { return {
handler=handler, handler=handler,