Permalink
Browse files

some dns fixes.

  • Loading branch information...
1 parent 53fc754 commit 5e6680108c0b8a7541e0871a99c9d76b346a4d3f Neil committed Aug 14, 2009
@@ -49,7 +49,7 @@
public static final String SERVICE_NAME = "Walrus";
public static final String VIRTUAL_SUBDOMAIN = "I_R_Bukkit";
- public static String WALRUS_DOMAIN = "walrus.darkness";
+ public static String WALRUS_DOMAIN = "walrus.localhost";
public static String WALRUS_IP = "127.0.0.1";
public static final long G = 1024*1024*1024;
public static final long M = 1024*1024;
@@ -39,15 +39,37 @@
package com.eucalyptus.cloud.ws;
-import org.xbill.DNS.*;
-
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.xbill.DNS.CNAMERecord;
+import org.xbill.DNS.Credibility;
+import org.xbill.DNS.DClass;
+import org.xbill.DNS.DNAMERecord;
+import org.xbill.DNS.ExtendedFlags;
+import org.xbill.DNS.Flags;
+import org.xbill.DNS.Header;
+import org.xbill.DNS.Message;
+import org.xbill.DNS.Name;
+import org.xbill.DNS.NameTooLongException;
+import org.xbill.DNS.OPTRecord;
+import org.xbill.DNS.Opcode;
+import org.xbill.DNS.RRset;
+import org.xbill.DNS.Rcode;
+import org.xbill.DNS.Record;
+import org.xbill.DNS.Section;
+import org.xbill.DNS.TSIG;
+import org.xbill.DNS.TSIGRecord;
+import org.xbill.DNS.Type;
+
+import com.eucalyptus.dns.SetResponse;
+import com.eucalyptus.dns.Zone;
+import com.eucalyptus.dns.Cache;
+
public class ConnectionHandler extends Thread {
static final int FLAG_DNSSECOK = 1;
@@ -39,8 +39,17 @@
import edu.ucsb.eucalyptus.cloud.entities.*;
import org.apache.log4j.Logger;
-import org.xbill.DNS.*;
+import com.eucalyptus.dns.Zone;
import org.xbill.DNS.Address;
+import org.xbill.DNS.CNAMERecord;
+import org.xbill.DNS.Record;
+import org.xbill.DNS.RRset;
+import org.xbill.DNS.DClass;
+import org.xbill.DNS.SOARecord;
+import org.xbill.DNS.ARecord;
+import org.xbill.DNS.Name;
+import org.xbill.DNS.NSRecord;
+import org.xbill.DNS.Type;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
@@ -163,12 +172,15 @@ public static void updateARecord(String zoneName, ARecord record) {
Zone zone = getZone(zoneName);
RRset rrSet = zone.findExactMatch(record.getName(), record.getDClass());
Iterator<Record> rrIterator = rrSet.rrs();
+ Record recordToRemove = null;
while(rrIterator.hasNext()) {
Record rec = rrIterator.next();
if(rec.getName().equals(record.getName())) {
- zone.removeRecord(rec);
+ recordToRemove = rec;
}
}
+ if(recordToRemove != null)
+ zone.removeRecord(recordToRemove);
zone.addRecord(record);
//now change the persistent store
EntityWrapper<ARecordInfo> db = new EntityWrapper<ARecordInfo>();
@@ -192,12 +204,15 @@ public static void updateCNAMERecord(String zoneName, CNAMERecord record) {
Zone zone = getZone(zoneName);
RRset rrSet = zone.findExactMatch(record.getName(), record.getDClass());
Iterator<Record> rrIterator = rrSet.rrs();
+ Record recordToRemove = null;
while(rrIterator.hasNext()) {
Record rec = rrIterator.next();
if(rec.getName().equals(record.getName())) {
- zone.removeRecord(rec);
+ recordToRemove = rec;
}
}
+ if(recordToRemove != null)
+ zone.removeRecord(recordToRemove);
zone.addRecord(record);
//now change the persistent store
EntityWrapper<CNAMERecordInfo> db = new EntityWrapper<CNAMERecordInfo>();
@@ -220,12 +235,15 @@ public static void deleteRecord(String zoneName, Record record) {
Zone zone = getZone(zoneName);
RRset rrSet = zone.findExactMatch(record.getName(), record.getDClass());
Iterator<Record> rrIterator = rrSet.rrs();
+ Record recordToRemove = null;
while(rrIterator.hasNext()) {
Record rec = rrIterator.next();
if(rec.getName().equals(record.getName())) {
- zone.removeRecord(rec);
+ recordToRemove = rec;
}
}
+ if(recordToRemove != null)
+ zone.removeRecord(recordToRemove);
} catch(Exception ex) {
LOG.error(ex);
}
@@ -235,4 +253,4 @@ public static void deleteZone(String zoneName) {
zones.remove(zoneName);
}
-}
+}
Oops, something went wrong.

0 comments on commit 5e66801

Please sign in to comment.