ZeroCM / zcm

Zero Communications and Marshalling
http://zerocm.github.io/zcm/
GNU Lesser General Public License v2.1
233 stars 67 forks source link

Fix transports that don't handle timeout=0 correctly #465

Closed xorvoid closed 6 months ago

xorvoid commented 6 months ago

Most of them handle it correctly. Fixed the ones that don't. May have overlooked a few things. A second pair of eyes would be great.

One weird thing:

transport_can.cpp is doing this:

uint64_t timeoutUs = timeoutMs >= 0 ? timeoutMs * 1e3 : numeric_limits<uint64_t>::max();
uint64_t timeoutLeft = timeoutUs;

And then its' calling the recvmsg function for serial:

int ret = zcm_trans_recvmsg(this->gst, msg, timeoutLeft);

Looks completely wrong?

jbendes commented 6 months ago

generic serial transport ignores timeout altogether since it's a nonblocking transport. You are right that it's misleading though. I've clarified that in the branch I pushed up on extending yours in https://github.com/ZeroCM/zcm/pull/466