[asterisk-commits] twilson: branch group/issue_17255-1.6.2 r315499 - /team/group/issue_17255-1.6...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 26 13:55:08 CDT 2011


Author: twilson
Date: Tue Apr 26 13:54:57 2011
New Revision: 315499

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=315499
Log:
Add my changes

Modified:
    team/group/issue_17255-1.6.2/channels/chan_sip.c

Modified: team/group/issue_17255-1.6.2/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/issue_17255-1.6.2/channels/chan_sip.c?view=diff&rev=315499&r1=315498&r2=315499
==============================================================================
--- team/group/issue_17255-1.6.2/channels/chan_sip.c (original)
+++ team/group/issue_17255-1.6.2/channels/chan_sip.c Tue Apr 26 13:54:57 2011
@@ -3240,36 +3240,6 @@
 	return NULL;
 }
 
-/* this func is used with ao2_callback to unlink/delete all marked
-   peers */
-static int peer_is_marked(void *peerobj, void *arg, int flags)
-{
-	struct sip_peer *peer = peerobj;
-	if (peer->the_mark && peer->pokeexpire != -1) {
-		AST_SCHED_DEL(sched, peer->pokeexpire);
-	}
-	return peer->the_mark ? CMP_MATCH : 0;
-}
-
-
-/* \brief Unlink all marked peers from ao2 containers */
-static void unlink_marked_peers_from_tables(void)
-{
-	ao2_t_callback(peers, OBJ_NODATA | OBJ_UNLINK | OBJ_MULTIPLE, peer_is_marked, NULL,
-						"initiating callback to remove marked peers");
-	ao2_t_callback(peers_by_ip, OBJ_NODATA | OBJ_UNLINK | OBJ_MULTIPLE, peer_is_marked, NULL,
-						"initiating callback to remove marked peers");
-}
-
-/* \brief Unlink single peer from all ao2 containers */
-static void unlink_peer_from_tables(struct sip_peer *peer)
-{
-	ao2_t_unlink(peers, peer, "ao2_unlink of peer from peers table");
-	if (peer->addr.sin_addr.s_addr) {
-		ao2_t_unlink(peers_by_ip, peer, "ao2_unlink of peer from peers_by_ip table");
-	}
-}
-
 #ifdef REF_DEBUG
 #define ref_peer(arg1,arg2) _ref_peer((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
 #define unref_peer(arg1,arg2) _unref_peer((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
@@ -3306,6 +3276,41 @@
 	return peer;
 }
 #endif
+
+/* this func is used with ao2_callback to unlink/delete all marked
+   peers */
+static int peer_is_marked(void *peerobj, void *arg, int flags)
+{
+	struct sip_peer *peer = peerobj;
+	if (peer->the_mark && peer->pokeexpire != -1) {
+		AST_SCHED_DEL_UNREF(sched, peer->pokeexpire,
+				unref_peer(peer, "removing poke peer ref"));
+	}
+	if (peer->the_mark && peer->expire != -1) {
+		AST_SCHED_DEL_UNREF(sched, peer->expire,
+				unref_peer(peer, "remove register expire ref"));
+	}
+	return peer->the_mark ? CMP_MATCH : 0;
+}
+
+
+/* \brief Unlink all marked peers from ao2 containers */
+static void unlink_marked_peers_from_tables(void)
+{
+	ao2_t_callback(peers, OBJ_NODATA | OBJ_UNLINK | OBJ_MULTIPLE, peer_is_marked, NULL,
+						"initiating callback to remove marked peers");
+	ao2_t_callback(peers_by_ip, OBJ_NODATA | OBJ_UNLINK | OBJ_MULTIPLE, peer_is_marked, NULL,
+						"initiating callback to remove marked peers");
+}
+
+/* \brief Unlink single peer from all ao2 containers */
+static void unlink_peer_from_tables(struct sip_peer *peer)
+{
+	ao2_t_unlink(peers, peer, "ao2_unlink of peer from peers table");
+	if (peer->addr.sin_addr.s_addr) {
+		ao2_t_unlink(peers_by_ip, peer, "ao2_unlink of peer from peers_by_ip table");
+	}
+}
 
 /*! \brief maintain proper refcounts for a sip_pvt's outboundproxy
  *
@@ -7842,6 +7847,7 @@
 			if (sip_pvt_trylock(p)) {
 				ao2_unlock(dialogs);
 				usleep(1);
+				p = dialog_unref(p, "pedantic linear search for dialog unref to restart search");
 				goto restartsearch;
 			}
 			ao2_unlock(dialogs);




More information about the asterisk-commits mailing list