Commit fe0ad539 authored by Alessio Igor Bogani's avatar Alessio Igor Bogani
Browse files

Changes

parent 2aab5168
......@@ -62,6 +62,8 @@ struct {
int lws_client_callback(struct lws *wsi, enum lws_callback_reasons reason,
void *user, void *in, size_t len)
{
char dsc[256];
int nsubscribers;
switch (reason) {
case LWS_CALLBACK_PROTOCOL_INIT:
case LWS_CALLBACK_CLIENT_HTTP_BIND_PROTOCOL:
......@@ -83,6 +85,9 @@ int lws_client_callback(struct lws *wsi, enum lws_callback_reasons reason,
break;
case LWS_CALLBACK_CLIENT_RECEIVE:
sscanf(in, "%s %s %s %s %s %s %s %s %s %s %d",
dsc, dsc, dsc, dsc, dsc, dsc,
dsc, dsc, dsc, dsc, &nsubscribers);
break;
case LWS_CALLBACK_CLIENT_RECEIVE_PONG:
......@@ -214,13 +219,17 @@ int main(int argc, const char **argv)
#if 0
counter++;
#endif
//printf("Attendo nuovi dati....\n");
poll(pfds, 2, -1);
//printf("Nuovi dati arrivati!\n");
clock_gettime(CLOCK_REALTIME, &now);
milliseconds = ((unsigned long long int)now.tv_sec * 1000) + ((unsigned long long int)now.tv_nsec / 1000000);
if (pfds[0].revents & POLLIN) {
//printf("Nuovi dati su buf0: Gli leggo....\n");
ret = read(pfds[0].fd, &buf0.payload.p2udt, sizeof(buf0.payload.p2udt));
//printf("Dati su buf0 letti!\n");
buf0.payload.milliseconds = milliseconds;
websocket[0].writeable = 0;
n = 0;
......@@ -232,7 +241,9 @@ int main(int argc, const char **argv)
}
if (pfds[1].revents & POLLIN) {
//printf("Nuovi dati su buf1: Gli leggo....\n");
ret = read(pfds[1].fd, &buf1.payload.p2udt, sizeof(buf1.payload.p2udt));
//printf("Dati su buf1 letti!\n");
buf1.payload.milliseconds = milliseconds;
#if 0
gettimeofday(&now, NULL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment