trabucayre / openFPGALoader

Universal utility for programming FPGA
https://trabucayre.github.io/openFPGALoader/
Apache License 2.0
1.22k stars 263 forks source link

SVC client fixup error handling #431

Closed mdavidsaver closed 9 months ago

mdavidsaver commented 9 months ago

In trying out openFPGALoader with a new (and therefore buggy) XVC server I managed to put openFPGALoader into a tight loop printing Send instruction failed when that server crashed.

Somewhat crudely, this PR throws a c++ exception in the places where ll_write() errors were being ignored. These exceptions are not caught, and so abort(). An improvement, although not ideal. It isn't clear to me how to communicate failure back through Xilinx::program().

Also, add sendall() logic as TCP socket send() may enqueue some, but not all, of the requested bytes.

mdavidsaver commented 9 months ago

This is the loop which sticks when shiftIR() returns immediately with an error.

https://github.com/trabucayre/openFPGALoader/blob/39be00fd56e8f532114e86a87f5b1d613159f8dd/src/xilinx.cpp#L727-L729

trabucayre commented 9 months ago

LGTM. Yes usual way is to use return with an error code and let caller deal with this value, but it's true in many part this error code isn't evaluated. Reasons are mainly:

trabucayre commented 9 months ago

Applied. Thanks @mdavidsaver