Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONOS
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
index ceab262..108b46a 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -579,7 +579,8 @@
 		log.debug("is peer {}", bgpPeers.containsKey(ribEntry.getNextHop()));
 		if (!bgpPeers.containsKey(ribEntry.getNextHop())) {
 			log.debug("Getting path for route with non-peer nexthop");
-			Path path = prefixToPath.get(prefix);
+			//Path path = prefixToPath.get(prefix);
+			Path path = prefixToPath.remove(prefix);
 			
 			if (path == null) {
 				log.error("No path found for non-peer path");
@@ -589,6 +590,7 @@
 			log.debug("users {}, permanent {}", path.getUsers(), path.isPermanent());
 			if (path.getUsers() <= 0 && !path.isPermanent()) {
 				deletePath(path);
+				pushedPaths.remove(path.getDstIpAddress());
 			}
 		}
 	}
@@ -687,6 +689,9 @@
 	private void calculateAndPushPath(Path path, MACAddress dstMacAddress) {
 		Interface dstInterface = path.getDstInterface();
 		
+		log.debug("Setting up path to {}, {}", path.getDstIpAddress().getHostAddress(),
+				dstMacAddress);
+		
 		List<PushedFlowMod> pushedFlows = new ArrayList<PushedFlowMod>();
 		
 		for (Interface srcInterface : interfaces.values()) {