GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Harden DnsNameResolverTest against transient null localAddress from T… · netty/netty@f435d97

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • resolver-dns/src/test/java/io/netty/resolver/dns
    • DnsNameResolverTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java‎

Copy file name to clipboardExpand all lines: resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverTest.java
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3571,7 +3571,17 @@ private static ServerSocket startDnsServerAndCreateServerSocket(TestDnsServer dn
35713571
serverSocket.bind(new InetSocketAddress(NetUtil.LOCALHOST4, 0));
35723572
try {
35733573
dns.start(null, (InetSocketAddress) serverSocket.getLocalSocketAddress());
3574-
return serverSocket;
3574+
if (dns.localAddress() != null) {
3575+
return serverSocket;
3576+
}
3577+
// The underlying UDP acceptor sometimes fails to bind without throwing (observed on Windows),
3578+
// leaving localAddress() null. Treat this the same as a failed bind and retry.
3579+
dns.stop();
3580+
serverSocket.close();
3581+
if (i == 10) {
3582+
Assumptions.abort(
3583+
"Unable to bind TestDnsServer and ServerSocket to the same address: localAddress is null");
3584+
}
35753585
} catch (IOException e) {
35763586
serverSocket.close();
35773587
if (i == 10) {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.