Replies: 1 comment 3 replies
Only registering the file ops is setup-time. The transfer itself (OSDP_CMD_FILE_TX) is submitted after refresh like any other command. Registering the ops belongs with the other things that shape a context: adding PDs, setting PD capabilities, and setting the callbacks. In the upcoming release, all of those are refused once the context has been refreshed. The reason is safety. Replacing the ops while a transfer was running meant aborting that transfer from inside the register call. That ran your close() op in the middle of a library call, and close() could then call back into LibOSDP and change state the library was still using it. This problem comes out of the rust bindings re-work which introduced async over the v4.0 API and this gap is more obvious/visible there. If we changed to rules a bit and disallow the ops registration during runtime, the problem goes away. As a side effect, LibOSDP has zero runtime (after fist seal) memory allocation which has been a long term goal for me with this project for predictable behavior on tiny embedded devices :).
When write() returns anything other than size, the PD rejects that chunk with a NAK. It does not answer with the FTSTAT abort status in the spec. On master (upcoming release), when write() returns anything other than size, the PD ends the transfer: it answers with the osdp_FTSTAT abort status (-1) and closes the file. The CP completes the FILE_TX command as failed and the PD stays online. In v3.2.0 and earlier, the PD instead stops replying and the CP takes it offline. That's the behaviour you're seeing, and it's fixed in the upcoming release. A gap is still left even on master: the PD side keeps its half of the transfer open after that NAK, and the CP does not send an abort to the PD. I'll fix this on the PD side so that a failed write ends the PD's half of the transfer too, ideally by answering with the FTSTAT abort status the spec defines. In the meantime, on master:
|
Uh oh!
There was an error while loading. Please reload this page.
I'm updating some code that uses libosdp, but I've come across a few questions on how file transfers work.
osdp_file_register_opsmust be called before theosdp_refresh, but all of the other commands can be sent after theosdp_refreshcalls. This is annoying because when acting as a CP I must keep track of both theosdp_pd_info_tand how it relates to theosdp_file_ops- there's no link between the two within libosdp.osdp_file_write_fn_tcallback does not seem to work. If my callback looks like the following:then it seems that libosdp acting as a CP does not handle the error properly. The PD side seems to keep responding with a NAK, but the CP side is not properly handling the response
All reactions