Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/zsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1845,13 +1845,10 @@ zsock_resolve (void *self)
if (zsock_is (self))
return ((zsock_t *) self)->handle;

// Check if we have a valid ZMQ socket by probing the socket type
int type;
size_t option_len = sizeof (int);
if (zmq_getsockopt (self, ZMQ_TYPE, &type, &option_len) == 0)
return self;

// Check if self is a valid FD or socket FD
// We need to check this before zmq_getsockopt, because tag check may
// cause a segfault if we are checking a native SOCKET (since the data
// type is smaller than the full object).
// TODO: this code should move to zsys_isfd () as we don't like
// non-portable code outside of that class.
int sock_type = -1;
Expand All @@ -1866,6 +1863,13 @@ zsock_resolve (void *self)
if (rc == 0 || (rc == -1 && errno == ENOTSOCK))
return NULL; // It's a socket FD or FD
#endif

// Check if we have a valid ZMQ socket by probing the socket type
int type;
size_t option_len = sizeof (int);
if (zmq_getsockopt (self, ZMQ_TYPE, &type, &option_len) == 0)
return self;

// Socket appears to be something else, return it as-is
return self;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ztimerset.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ ztimerset_test (bool verbose)
assert (!timer_invoked);
int timeout = ztimerset_timeout (self);
assert (timeout > 0);
zclock_sleep (timeout);
zclock_sleep (timeout + 20);
rc = ztimerset_execute (self);
assert (rc == 0);
assert (timer_invoked);
Expand Down
Loading