[asterisk-commits] mmichelson: branch group/manager2 r113558 - /team/group/manager2/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 8 16:32:35 CDT 2008


Author: mmichelson
Date: Tue Apr  8 16:32:34 2008
New Revision: 113558

URL: http://svn.digium.com/view/asterisk?view=rev&rev=113558
Log:
Add sin_family setting to the socket skeleton function, clarify some doxy comments, 
flush the stream after writing to it, and just for kicks, change the port number I'm
using for now.


Modified:
    team/group/manager2/res/res_manager2.c

Modified: team/group/manager2/res/res_manager2.c
URL: http://svn.digium.com/view/asterisk/team/group/manager2/res/res_manager2.c?view=diff&rev=113558&r1=113557&r2=113558
==============================================================================
--- team/group/manager2/res/res_manager2.c (original)
+++ team/group/manager2/res/res_manager2.c Tue Apr  8 16:32:34 2008
@@ -68,7 +68,6 @@
 
 AST_LIST_HEAD_STATIC(subscribers, subscriber);
 
-#define QUEUE_EVENT_BEGIN AST_EVENT_QUEUE_MEMBER_STATUS
 struct ast_event_sub *login_sub;
 
 /*! \brief Take our event and put it into our own queue
@@ -143,6 +142,7 @@
 
 		ast_str_append(&buf, 0, "%s", "\r\n");
 		fwrite(buf->str, buf->used, sizeof(char), sub->f);
+		fflush(sub->f);
 		ast_event_destroy(event->event);
 		ast_free(event);
 		event = NULL;
@@ -173,8 +173,8 @@
 	ast_cond_init(&sub->cond, NULL);
 }
 
-/*! \brief This is the callback which is called when
- * a someone logs into the manager interface. It tells us that someone
+/*! \brief This is the worker function which is called when
+ * a someone logs into the event subscription interface. It tells us that someone
  * wants to receive event notification from us. This function initializes
  * the subscriber struct and starts the thread which waits for events so
  * it can spit them out in string form
@@ -185,6 +185,7 @@
  */
 static void *subscribe_start(void *data)
 {
+	struct ast_tcptls_session_instance *ser = data;
 	struct subscriber *sub;
 
 	if (!(sub = ast_calloc(1, sizeof(*sub)))) {
@@ -196,6 +197,7 @@
 	/* For now, hard code "mark" as the name */
 
 	ast_copy_string(sub->name, "mark", sizeof(sub->name));
+	sub->f = ser->f;
 
 	ast_debug(3, "Event subscriber %s logged in\n", sub->name);
 
@@ -253,10 +255,11 @@
 	/* You have no choice of port or IP address right now.
 	 * I just want this to "work"
 	 *
-	 * We use port 24824 and wildcard address.
+	 * We use port 666 and wildcard address.
 	 */
 	memset(&event_server.sin, 0, sizeof(event_server.sin));
-	event_server.sin.sin_port = htons(24824);
+	event_server.sin.sin_port = htons(666);
+	event_server.sin.sin_family = AF_INET;
 	ast_tcptls_server_start(&event_server);
 }
 




More information about the asterisk-commits mailing list