You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some of the callback functions specified by the messager struct were
badly named; their names have been updated to reflect their actual
usage.
Additionally, the GLib implementations provide some utility functions
that make looping really easy. A complete event loop using poll(2) now
looks something like this:
while (!curvecpr_client_messager_glib_is_finished(cmg)) {
long long timeout =
curvecpr_client_messager_glib_next_timeout(cmg) / 1000000;
struct pollfd polls[1] = {
{ .fd = my_socket, .events = POLLIN }
};
if (poll(polls, 1, timeout) < 0)
break;
if (polls[0].revents) {
unsigned char buf[1152];
int r = recvfrom(my_socket, buf, 1152, 0, NULL, NULL);
if (r <= 0)
break;
curvecpr_client_messager_glib_recv(cmg, buf, r);
}
curvecpr_client_messager_glib_process_sendq(cmg);
}
0 commit comments