Skip to content

Commit

Permalink
printfs
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesLorenz committed Dec 3, 2023
1 parent 77dde8b commit 9108af7
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1646,10 +1646,13 @@ int lo_server_recv(lo_server s)

again:
if (sched_time > 0.01) {
fprintf(stderr, "r1\n");
if (sched_time > 10.0) {
fprintf(stderr, "r2\n");
sched_time = 10.0;
}
#ifdef HAVE_POLL
fprintf(stderr, "r3\n");
for (i = 0; i < s->sockets_len; i++) {
s->sockets[i].events = POLLIN | POLLPRI | POLLERR | POLLHUP;
s->sockets[i].revents = 0;
Expand All @@ -1661,9 +1664,12 @@ int lo_server_recv(lo_server s)
goto got_data;
}
}
fprintf(stderr, "r4\n");

poll(s->sockets, s->sockets_len, (int) (sched_time * 1000.0));

fprintf(stderr, "r5\n");

for (i = 0; i < s->sockets_len; i++) {
if (!s->sockets[i].revents)
continue;
Expand All @@ -1677,6 +1683,8 @@ int lo_server_recv(lo_server s)
}
break;
}

fprintf(stderr, "r6\n");

if (i >= s->sockets_len) {
sched_time = lo_server_next_event_delay(s);
Expand All @@ -1686,13 +1694,14 @@ int lo_server_recv(lo_server s)

return dispatch_queued(s, 0);
}
fprintf(stderr, "r7\n");
#else
#ifdef HAVE_SELECT
#if defined(WIN32) || defined(_MSC_VER)
if (!initWSock())
return 0;
#endif

fprintf(stderr, "r8\n");
FD_ZERO(&ps);
for (i = 0; i < s->sockets_len; i++) {
FD_SET(s->sockets[i].fd, &ps);
Expand All @@ -1706,14 +1715,14 @@ int lo_server_recv(lo_server s)
goto got_data;
}
}

fprintf(stderr, "r9\n");
stimeout.tv_sec = sched_time;
stimeout.tv_usec = (sched_time - stimeout.tv_sec) * 1.e6;
res = select(nfds + 1, &ps, NULL, NULL, &stimeout);
if (res == SOCKET_ERROR) {
return 0;
}

fprintf(stderr, "r10\n");
if (!res) {
sched_time = lo_server_next_event_delay(s);

Expand All @@ -1722,25 +1731,31 @@ int lo_server_recv(lo_server s)

return dispatch_queued(s, 0);
}
fprintf(stderr, "r11\n");
#endif
#endif
} else {
fprintf(stderr, "r12\n");
return dispatch_queued(s, 0);
}
if (s->protocol == LO_TCP) {
fprintf(stderr, "r13\n");
data = lo_server_recv_raw_stream(s, &size, &sock);
} else {
data = lo_server_recv_raw(s, &size);
}
fprintf(stderr, "r14\n");

if (!data) {
return 0;
}
got_data:
fprintf(stderr, "r15\n");
if (dispatch_data(s, data, size, sock) < 0) {
free(data);
return -1;
}
fprintf(stderr, "r16\n");
free(data);
return (int) size;
}
Expand Down

0 comments on commit 9108af7

Please sign in to comment.