Tell the extjs web ui to whom it's talking to

This commit is contained in:
Andreas Öman 2009-11-18 22:24:44 +00:00
parent ab3ce01643
commit 74582843b4

View file

@ -22,6 +22,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <libavutil/md5.h>
@ -150,6 +151,29 @@ comet_access_update(http_connection_t *hc, comet_mailbox_t *cmb)
htsmsg_add_msg(cmb->cmb_messages, NULL, m);
}
/**
*
*/
static void
comet_serverIpPort(http_connection_t *hc, comet_mailbox_t *cmb)
{
char buf[INET_ADDRSTRLEN + 1];
inet_ntop(AF_INET, &hc->hc_self->sin_addr, buf, sizeof(buf));
htsmsg_t *m = htsmsg_create_map();
htsmsg_add_str(m, "notificationClass", "setServerIpPort");
htsmsg_add_str(m, "ip", buf);
htsmsg_add_u32(m, "port", ntohs(hc->hc_self->sin_port));
if(cmb->cmb_messages == NULL)
cmb->cmb_messages = htsmsg_create_list();
htsmsg_add_msg(cmb->cmb_messages, NULL, m);
}
/**
* Poll callback
*/
@ -177,6 +201,7 @@ comet_mailbox_poll(http_connection_t *hc, const char *remain, void *opaque)
if(cmb == NULL) {
cmb = comet_mailbox_create();
comet_access_update(hc, cmb);
comet_serverIpPort(hc, cmb);
}
time(&reqtime);