Archived
3
0

pubsubd: code removal

This commit is contained in:
Philippe PITTOLI 2016-09-13 22:13:33 +02:00
parent beac3f7883
commit c64a91cdaf

View File

@ -67,53 +67,6 @@ void * pubsubd_worker_thread (void *params)
}
pubsubd_msg_free (&m);
}
#if 0
#endif
#if 0
while (1) {
// each chan has a list of subscribers
// someone who only push a msg doesn't need to be registered
// if (wp->ale->action == PUBSUB_BOTH || wp->ale->action == PUBSUB_PUB) {
if (wp->ale->action == PUBSUB_PUB) {
// publish a message
printf ("publish to chan %s\n", wp->chan->chan);
struct pubsub_msg m;
memset (&m, 0, sizeof (struct pubsub_msg));
sleep (5); // TODO DEBUG
pubsubd_msg_recv (wp->ale->p, &m);
pubsubd_msg_print (&m);
if (m.type == PUBSUB_TYPE_DISCONNECT) {
// TODO remove the application from the subscribers
if ( 0 != pubsubd_subscriber_del (wp->chan->alh, wp->ale)) {
fprintf (stderr, "err : subscriber not registered\n");
}
break;
}
else {
struct channel *chan = pubsubd_channel_get (wp->chans, wp->chan);
pubsubd_msg_send (chan->alh, &m);
}
}
else if (wp->ale->action == PUBSUB_SUB) {
// subscribe to a channel, no need to loop
// already subscribed
// printf ("subscribe to %s\n", wp->chan->chan);
// pubsubd_subscriber_add (wp->chan->alh, wp->ale);
break;
}
else {
// unrecognized command, no need to loop
printf ("\033[31mdo not know what you want to do\033[00m\n");
printf ("\tale->p : %p\n", (void*) wp->ale->p);
break;
}
}
#endif
pubsubd_app_list_elm_free (ale);