[asterisk-commits] kmoore: branch kmoore/stasis-mwi r382647 - in /team/kmoore/stasis-mwi: channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 7 15:55:00 CST 2013


Author: kmoore
Date: Thu Mar  7 15:54:57 2013
New Revision: 382647

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382647
Log:
Address review feedback from dlee

Modified:
    team/kmoore/stasis-mwi/channels/chan_sip.c
    team/kmoore/stasis-mwi/include/asterisk/app.h
    team/kmoore/stasis-mwi/include/asterisk/stasis.h
    team/kmoore/stasis-mwi/main/app.c
    team/kmoore/stasis-mwi/main/stasis_cache.c
    team/kmoore/stasis-mwi/main/stasis_message.c
    team/kmoore/stasis-mwi/res/res_jabber.c
    team/kmoore/stasis-mwi/res/res_xmpp.c

Modified: team/kmoore/stasis-mwi/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_sip.c?view=diff&rev=382647&r1=382646&r2=382647
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_sip.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_sip.c Thu Mar  7 15:54:57 2013
@@ -27687,9 +27687,7 @@
 	struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
 
 	AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
-		if (mailbox->event_sub) {
-			stasis_unsubscribe(mailbox->event_sub);
-		}
+		stasis_unsubscribe(mailbox->event_sub);
 
 		ast_str_reset(uniqueid);
 		ast_str_set(&uniqueid, 0, "%s@%s", mailbox->mailbox, S_OR(mailbox->context, "default"));

Modified: team/kmoore/stasis-mwi/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/include/asterisk/app.h?view=diff&rev=382647&r1=382646&r2=382647
==============================================================================
--- team/kmoore/stasis-mwi/include/asterisk/app.h (original)
+++ team/kmoore/stasis-mwi/include/asterisk/app.h Thu Mar  7 15:54:57 2013
@@ -1132,6 +1132,7 @@
 	);
 	int new_msgs;				/*!< The current number of new messages for this mailbox */
 	int old_msgs;				/*!< The current number of old messages for this mailbox */
+	struct ast_eid eid;			/*!< The EID of the server where this message originated */
 };
 
 /*!

Modified: team/kmoore/stasis-mwi/include/asterisk/stasis.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/include/asterisk/stasis.h?view=diff&rev=382647&r1=382646&r2=382647
==============================================================================
--- team/kmoore/stasis-mwi/include/asterisk/stasis.h (original)
+++ team/kmoore/stasis-mwi/include/asterisk/stasis.h Thu Mar  7 15:54:57 2013
@@ -209,23 +209,6 @@
  * \since 12
  */
 const struct timeval *stasis_message_timestamp(const struct stasis_message *msg);
-
-/*!
- * \brief Set the EID for the server on which this message was created.
- * \param msg Message.
- * \param eid EID to set on this message.
- * \since 12
- */
-void stasis_message_eid_set(struct stasis_message *msg, const struct ast_eid *eid);
-
-/*!
- * \brief Get the EID for the server on which this message was created.
- * \param msg Message.
- * \return Pointer to the \a eid.
- * \return \c NULL if msg is \c NULL.
- * \since 12
- */
-const struct ast_eid *stasis_message_eid(const struct stasis_message *msg);
 
 /*! @} */
 

Modified: team/kmoore/stasis-mwi/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/main/app.c?view=diff&rev=382647&r1=382646&r2=382647
==============================================================================
--- team/kmoore/stasis-mwi/main/app.c (original)
+++ team/kmoore/stasis-mwi/main/app.c Thu Mar  7 15:54:57 2013
@@ -2744,11 +2744,13 @@
 	ast_string_field_set(mwi_state, context, context);
 	mwi_state->new_msgs = new_msgs;
 	mwi_state->old_msgs = old_msgs;
+	if (eid) {
+		mwi_state->eid = *eid;
+	} else {
+		ast_set_default_eid(&mwi_state->eid);
+	}
 
 	message = stasis_message_create(stasis_mwi_state(), mwi_state);
-	if (eid) {
-		stasis_message_eid_set(message, eid);
-	}
 
 	ast_assert(stasis_mwi_topic(ast_str_buffer(uniqueid)) != NULL);
 	stasis_publish(stasis_mwi_topic(ast_str_buffer(uniqueid)), message);

Modified: team/kmoore/stasis-mwi/main/stasis_cache.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/main/stasis_cache.c?view=diff&rev=382647&r1=382646&r2=382647
==============================================================================
--- team/kmoore/stasis-mwi/main/stasis_cache.c (original)
+++ team/kmoore/stasis-mwi/main/stasis_cache.c Thu Mar  7 15:54:57 2013
@@ -214,15 +214,11 @@
 {
 	struct cache_dump_data *cache_dump = arg;
 	struct cache_entry *entry = obj;
-	if (!cache_dump->type) {
+
+	if (!cache_dump->type || entry->type == cache_dump->type) {
 		ao2_link(cache_dump->cached, entry->snapshot);
-		return 0;
-	}
-
-	if (entry->type == cache_dump->type) {
-		ao2_link(cache_dump->cached, entry->snapshot);
-		return 0;
-	}
+	}
+
 	return 0;
 }
 

Modified: team/kmoore/stasis-mwi/main/stasis_message.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/main/stasis_message.c?view=diff&rev=382647&r1=382646&r2=382647
==============================================================================
--- team/kmoore/stasis-mwi/main/stasis_message.c (original)
+++ team/kmoore/stasis-mwi/main/stasis_message.c Thu Mar  7 15:54:57 2013
@@ -78,8 +78,6 @@
 	struct stasis_message_type *type;
 	/*! Message content */
 	void *data;
-	/*! Server EID */
-	struct ast_eid eid;
 };
 
 static void stasis_message_dtor(void *obj)
@@ -108,8 +106,6 @@
 	ao2_ref(data, +1);
 	message->data = data;
 
-	ast_set_default_eid(&message->eid);
-
 	ao2_ref(message, +1);
 	return message;
 }
@@ -137,19 +133,3 @@
 	}
 	return &msg->timestamp;
 }
-
-void stasis_message_eid_set(struct stasis_message *msg, const struct ast_eid *eid)
-{
-	if (msg == NULL) {
-		return;
-	}
-	msg->eid = *eid;
-}
-
-const struct ast_eid *stasis_message_eid(const struct stasis_message *msg)
-{
-	if (msg == NULL) {
-		return NULL;
-	}
-	return &msg->eid;
-}

Modified: team/kmoore/stasis-mwi/res/res_jabber.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/res/res_jabber.c?view=diff&rev=382647&r1=382646&r2=382647
==============================================================================
--- team/kmoore/stasis-mwi/res/res_jabber.c (original)
+++ team/kmoore/stasis-mwi/res/res_jabber.c Thu Mar  7 15:54:57 2013
@@ -3255,14 +3255,12 @@
 		return;
 	}
 
-	if (ast_eid_cmp(&ast_eid_default, stasis_message_eid(msg)))
-	{
+	mwi_state = stasis_message_data(msg);
+
+	if (ast_eid_cmp(&ast_eid_default, &mwi_state->eid)) {
 		/* If the event didn't originate from this server, don't send it back out. */
-		ast_debug(1, "Returning here\n");
 		return;
 	}
-
-	mwi_state = stasis_message_data(msg);
 
 	mailbox = mwi_state->mailbox;
 	context = mwi_state->context;

Modified: team/kmoore/stasis-mwi/res/res_xmpp.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/res/res_xmpp.c?view=diff&rev=382647&r1=382646&r2=382647
==============================================================================
--- team/kmoore/stasis-mwi/res/res_xmpp.c (original)
+++ team/kmoore/stasis-mwi/res/res_xmpp.c Thu Mar  7 15:54:57 2013
@@ -1333,13 +1333,12 @@
 		return;
 	}
 
-	if (ast_eid_cmp(&ast_eid_default, stasis_message_eid(msg))) {
+	mwi_state = stasis_message_data(msg);
+
+	if (ast_eid_cmp(&ast_eid_default, &mwi_state->eid)) {
 		/* If the event didn't originate from this server, don't send it back out. */
-		ast_debug(1, "Returning here\n");
 		return;
 	}
-
-	mwi_state = stasis_message_data(msg);
 
 	mailbox = mwi_state->mailbox;
 	context = mwi_state->context;




More information about the asterisk-commits mailing list