Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /server/registry.cpp [c9712f] .. [3965e0] Maximize Restore

  Switch to side-by-side view

--- a/server/registry.cpp
+++ b/server/registry.cpp
@@ -1014,7 +1014,7 @@
 	locking.release();
 }
 
-unsigned registry::mapped::setTarget(Socket::address& target_addr, time_t lease, const char *target_contact, const char *target_policy)
+unsigned registry::mapped::setTarget(Socket::address& target_addr, time_t lease, const char *target_contact, const char *target_network)
 {
 	assert(!isnull(target_addr));
 	assert(target_contact != NULL && *target_contact != 0);
@@ -1073,9 +1073,9 @@
 		if(origin) 
 			delete origin;
 	}
-	String::set(tp->policy, sizeof(tp->policy), target_policy);
+	String::set(tp->network, sizeof(tp->network), target_network);
 	String::set(tp->contact, sizeof(tp->contact), target_contact);
-	String::set(policy, sizeof(policy), target_policy);
+	String::set(network, sizeof(network), target_network);
 	uri::userid(target_contact, remote, sizeof(remote));
 	locking.share();
 	return 1;
@@ -1282,7 +1282,7 @@
 	return false;
 }
 
-unsigned registry::mapped::addTarget(Socket::address& target_addr, time_t lease, const char *target_contact, const char *target_policy)
+unsigned registry::mapped::addTarget(Socket::address& target_addr, time_t lease, const char *target_contact, const char *target_network)
 {
 	assert(!isnull(target_addr));
 	assert(target_contact != NULL && *target_contact != 0);
@@ -1328,7 +1328,7 @@
 			time(&tp->created);
 		tp->expires = lease;
 		String::set(tp->contact, sizeof(tp->contact), target_contact);
-		String::set(tp->policy, sizeof(tp->policy), target_policy);
+		String::set(tp->network, sizeof(tp->network), target_network);
 		locking.share();
 		return count;
 	}
@@ -1343,7 +1343,7 @@
 		expired->enlist(&internal.targets);
 		expired->status = registry::target::READY;
 		memcpy(&contact, oi, len);
-		String::set(policy, sizeof(policy), target_policy);
+		String::set(network, sizeof(network), target_network);
 		uri::userid(target_contact, remote, sizeof(remote));
 		if(origin)
 			delete origin;
@@ -1354,7 +1354,7 @@
 	memcpy(&expired->address, ai, len);
 	stack::getInterface((struct sockaddr *)(&expired->iface), (struct sockaddr *)(&expired->address));
 	String::set(expired->contact, sizeof(expired->contact), target_contact);
-	String::set(expired->policy, sizeof(expired->policy), target_policy);
+	String::set(expired->network, sizeof(expired->network), target_network);
 	expired->index.registry = this;
 	expired->index.address = (struct sockaddr *)(&expired->address);
 	expired->index.enlist(&addresses[Socket::keyindex(expired->index.address, keysize)]); 
@@ -1367,7 +1367,7 @@
 {
 	assert(!isnull(target_addr));
 
-	cidr *access = NULL;
+	const char *subnet = NULL;
 	struct addrinfo *al;
 	linked_pointer<target> tp;
 	socklen_t len;
@@ -1394,13 +1394,10 @@
 
 		tp = new target;
 		time(&tp->created);
-		access = server::getPolicy(al->ai_addr);
-		if(access)
-			String::set(tp->policy, sizeof(tp->policy), access->getName());
-		else
-			String::set(tp->policy, sizeof(tp->policy), "*");
-		server::release(access);
-		String::set(policy, sizeof(policy), tp->policy);
+		subnet = server::getNetwork(al->ai_addr);
+		String::set(tp->network, sizeof(tp->network), subnet);
+		server::release(subnet);
+		String::set(network, sizeof(network), tp->network);
 		memcpy(&tp->address, al->ai_addr, len);
 		memcpy(&contact, &tp->address, len);
 		remote[0] = 0;