Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
BIND
Commits
c202b9f4
Commit
c202b9f4
authored
Dec 03, 2004
by
Mark Andrews
Browse files
1773. [bug] Fast retry on host / net unreachable. [RT #13153]
parent
cf74c9cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
CHANGES
View file @
c202b9f4
...
...
@@ -16,7 +16,7 @@
1774. [port] Aix: Silence compiler warnings / build failures.
[RT #13154]
1773. [
placeholder] rt
13153
1773. [
bug] Fast retry on host / net unreachable. [RT #
13153
]
1772. [placeholder]
...
...
lib/dns/resolver.c
View file @
c202b9f4
...
...
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resolver.c,v 1.29
8
2004/1
1/10 21:57:46
marka Exp $ */
/* $Id: resolver.c,v 1.29
9
2004/1
2/03 01:59:28
marka Exp $ */
#include <config.h>
...
...
@@ -762,6 +762,9 @@ static void
resquery_senddone
(
isc_task_t
*
task
,
isc_event_t
*
event
)
{
isc_socketevent_t
*
sevent
=
(
isc_socketevent_t
*
)
event
;
resquery_t
*
query
=
event
->
ev_arg
;
isc_boolean_t
retry
=
ISC_FALSE
;
isc_result_t
result
;
fetchctx_t
*
fctx
;
REQUIRE
(
event
->
ev_type
==
ISC_SOCKEVENT_SENDDONE
);
...
...
@@ -780,6 +783,7 @@ resquery_senddone(isc_task_t *task, isc_event_t *event) {
INSIST
(
RESQUERY_SENDING
(
query
));
query
->
sends
--
;
fctx
=
query
->
fctx
;
if
(
RESQUERY_CANCELED
(
query
))
{
if
(
query
->
sends
==
0
)
{
...
...
@@ -791,16 +795,43 @@ resquery_senddone(isc_task_t *task, isc_event_t *event) {
isc_socket_detach
(
&
query
->
tcpsocket
);
resquery_destroy
(
&
query
);
}
}
else
if
(
sevent
->
result
==
ISC_R_HOSTUNREACH
||
sevent
->
result
==
ISC_R_NETUNREACH
)
/*
* No route to remote.
*/
fctx_cancelquery
(
&
query
,
NULL
,
NULL
,
ISC_TRUE
);
else
if
(
sevent
->
result
!=
ISC_R_SUCCESS
)
fctx_cancelquery
(
&
query
,
NULL
,
NULL
,
ISC_FALSE
);
}
else
switch
(
sevent
->
result
)
{
case
ISC_R_SUCCESS
:
break
;
case
ISC_R_HOSTUNREACH
:
case
ISC_R_NETUNREACH
:
case
ISC_R_NOPERM
:
case
ISC_R_ADDRNOTAVAIL
:
case
ISC_R_CONNREFUSED
:
/*
* No route to remote.
*/
fctx_cancelquery
(
&
query
,
NULL
,
NULL
,
ISC_TRUE
);
retry
=
ISC_TRUE
;
break
;
default:
fctx_cancelquery
(
&
query
,
NULL
,
NULL
,
ISC_FALSE
);
break
;
}
isc_event_free
(
&
event
);
if
(
retry
)
{
/*
* Behave as if the idle timer has expired. For TCP
* this may not actually reflect the latest timer.
*/
fctx
->
attributes
&=
~
FCTX_ATTR_ADDRWAIT
;
result
=
fctx_stopidletimer
(
fctx
);
if
(
result
!=
ISC_R_SUCCESS
)
fctx_done
(
fctx
,
result
);
else
fctx_try
(
fctx
);
}
}
static
inline
isc_result_t
...
...
@@ -1317,7 +1348,10 @@ static void
resquery_connected
(
isc_task_t
*
task
,
isc_event_t
*
event
)
{
isc_socketevent_t
*
sevent
=
(
isc_socketevent_t
*
)
event
;
resquery_t
*
query
=
event
->
ev_arg
;
isc_boolean_t
retry
=
ISC_FALSE
;
isc_result_t
result
;
unsigned
int
attrs
;
fetchctx_t
*
fctx
;
REQUIRE
(
event
->
ev_type
==
ISC_SOCKEVENT_CONNECT
);
REQUIRE
(
VALID_QUERY
(
query
));
...
...
@@ -1335,6 +1369,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) {
*/
query
->
connects
--
;
fctx
=
query
->
fctx
;
if
(
RESQUERY_CANCELED
(
query
))
{
/*
...
...
@@ -1344,9 +1379,8 @@ resquery_connected(isc_task_t *task, isc_event_t *event) {
isc_socket_detach
(
&
query
->
tcpsocket
);
resquery_destroy
(
&
query
);
}
else
{
if
(
sevent
->
result
==
ISC_R_SUCCESS
)
{
unsigned
int
attrs
;
switch
(
sevent
->
result
)
{
case
ISC_R_SUCCESS
:
/*
* We are connected. Create a dispatcher and
* send the query.
...
...
@@ -1379,25 +1413,46 @@ resquery_connected(isc_task_t *task, isc_event_t *event) {
result
=
resquery_send
(
query
);
if
(
result
!=
ISC_R_SUCCESS
)
{
fetchctx_t
*
fctx
=
query
->
fctx
;
fctx_cancelquery
(
&
query
,
NULL
,
NULL
,
ISC_FALSE
);
fctx_done
(
fctx
,
result
);
}
}
else
if
(
sevent
->
result
==
ISC_R_HOSTUNREACH
||
sevent
->
result
==
ISC_R_NETUNREACH
)
{
break
;
case
ISC_R_NETUNREACH
:
case
ISC_R_HOSTUNREACH
:
case
ISC_R_CONNREFUSED
:
case
ISC_R_NOPERM
:
case
ISC_R_ADDRNOTAVAIL
:
/*
* No route to remote.
*/
isc_socket_detach
(
&
query
->
tcpsocket
);
fctx_cancelquery
(
&
query
,
NULL
,
NULL
,
ISC_TRUE
);
}
else
{
retry
=
ISC_TRUE
;
break
;
default:
isc_socket_detach
(
&
query
->
tcpsocket
);
fctx_cancelquery
(
&
query
,
NULL
,
NULL
,
ISC_FALSE
);
break
;
}
}
isc_event_free
(
&
event
);
if
(
retry
)
{
/*
* Behave as if the idle timer has expired. For TCP
* connections this may not actually reflect the latest timer.
*/
fctx
->
attributes
&=
~
FCTX_ATTR_ADDRWAIT
;
result
=
fctx_stopidletimer
(
fctx
);
if
(
result
!=
ISC_R_SUCCESS
)
fctx_done
(
fctx
,
result
);
else
fctx_try
(
fctx
);
}
}
static
void
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment