On Fri, 2020-03-06 at 23:06 +0000, Andreas Sandberg wrote: > > [ ... ] > > Related to these pull requests, there is a workaround for a Bluetooth issue > that I encountered when connecting to my UM24C. The workaround [6] adds a > retry if connect() returns EBUSY. There was a discussion about this on the > list a while back. > > [ ... ] > > [6] https://github.com/sigrokproject/libsigrok/pull/44
The discussion did not reveal the time span which was involved. That's when I assumed the typical issue of half-closed sockets. Your patch suggests it's fractions of a second instead. Which is rather different. Only had a cursory look. The change is to repeat the connect() attempt up to three times with 100ms in between? Looks plausible to me. Would not kick in for already-working setups, only helps avoid occassional failure in edge cases. Good. Would be nice to check this in more setups. Who runs serially attached devices in combination with e.g. HC05 "cables", or wants to? And can help test the change, to increase coverage? Minor style nits, some of it a matter of taste: I'd rather count retries backwards. Better communicates when they are exhausted. Check for leaks. Does the bottom perror(3) case lack a close(2) call? Is shutdown(2) required before close(2) since there is no other layer in play for the error paths? Or is shutdown(2) not needed because connect(2) did not succeed yet? What about the EBUSY case? Won't comment on the UM/TC part due to lack of knowledge. virtually yours Gerhard Sittig -- If you don't understand or are scared by any of the above ask your parents or an adult to help you. _______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel