1
0
Fork 0

update `listen` docstring

This commit is contained in:
Daniel Barlow 2022-10-04 21:11:17 +01:00
parent 55688c14ed
commit 71e37f1b96
1 changed files with 10 additions and 9 deletions

View File

@ -247,15 +247,16 @@ function tftp:listen(rrq_generator_callback, wrq_generator_callback, hosts, port
and get data from / send data to user-generated source/sink functions. and get data from / send data to user-generated source/sink functions.
Data is generated/received by functions returned by the the user-supplied Data is generated/received by functions returned by the the user-supplied
``rrq_generator_callback``/``wrq_generator_callback`` factory functions. ``rrq_generator_callback``/``wrq_generator_callback`` factory functions.
For every valid request packet received the generator function returned by For each resource requested, the generator function will be called
``xrq_generator_callback`` will be called expecting data. with three arguments:
- the requested resource as a C-style string (no embedded NUL chars)
When called with a single argument, - the ip address of the peer, as a dotted-quad string ("1.2.3.4")
(the requested resource as a C-style string (no embedded NUL chars)) - the port number of the peer
``xrq_generator_callback`` should return a source or sink function that: It should return a source or sink function that will be called repeatedly
(SOURCE) takes a single argument of the required data length in bytes until the data transfer is complete:
and returns blocks of data until complete. (SOURCE) will be called once for each block of data : it takes a
must return as follows single argument of the requested data length in bytes
and returns the next block of data. It must return as follows
`true, data` on success `true, data` on success
`true, nil` on wouldblock but should retry next round, `true, nil` on wouldblock but should retry next round,
`false` on finished `false` on finished