Skip to content

Commit 99ef7eb

Browse files
author
bwelling
committed
add show command, catch socket exception, don't send empty update
git-svn-id: http://svn.code.sf.net/p/dnsjava/code/trunk@503 c76caeb1-94fd-44dd-870f-0c9d92034fc1
1 parent c3aa654 commit 99ef7eb

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

update.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ else if (operation.equals("send")) {
158158
query.getHeader().setOpcode(Opcode.UPDATE);
159159
}
160160

161+
else if (operation.equals("show")) {
162+
print(query);
163+
}
164+
161165
else if (operation.equals("query"))
162166
doQuery(st);
163167

@@ -195,11 +199,18 @@ else if (operation.equals("assert")) {
195199
catch (InterruptedIOException iioe) {
196200
System.out.println("Operation timed out");
197201
}
202+
catch (SocketException se) {
203+
System.out.println("Socket error");
204+
}
198205
}
199206
}
200207

201208
void
202209
sendUpdate() throws IOException {
210+
if (query.getHeader().getCount(Section.UPDATE) == 0) {
211+
print("Empty update message. Ignoring.");
212+
return;
213+
}
203214
if (query.getHeader().getCount(Section.ZONE) == 0) {
204215
Name updzone;
205216
if (zone != null)
@@ -512,7 +523,7 @@ else if ((section = Section.value(field)) >= 0) {
512523
"add assert class delete echo file\n" +
513524
"glue help log key edns origin\n" +
514525
"port prohibit query quit require send\n" +
515-
"server tcp ttl zone #\n");
526+
"server show tcp ttl zone #\n");
516527

517528
else if (topic.equalsIgnoreCase("add"))
518529
System.out.println(
@@ -605,6 +616,10 @@ else if (topic.equalsIgnoreCase("server"))
605616
System.out.println(
606617
"server <name>\n\n" +
607618
"server that receives send updates/queries\n");
619+
else if (topic.equalsIgnoreCase("show"))
620+
System.out.println(
621+
"show\n\n" +
622+
"shows the current update packet\n");
608623
else if (topic.equalsIgnoreCase("tcp"))
609624
System.out.println(
610625
"tcp\n\n" +

0 commit comments

Comments
 (0)