@@ -81,15 +81,15 @@ func processDNSCryptQuery(
8181
8282 // Check for stale response if there was an error
8383 if err != nil {
84- serverInfo .noticeFailure (proxy )
8584 if stale , ok := pluginsState .sessionData ["stale" ]; ok {
8685 dlog .Debug ("Serving stale response" )
8786 staleMsg := stale .(* dns.Msg )
8887 if packErr := staleMsg .Pack (); packErr == nil {
8988 return staleMsg .Data , nil
9089 }
9190 }
92- // If no stale response was served, return the original error
91+ // No stale response available; this is a definitive failure
92+ serverInfo .noticeFailure (proxy )
9393 if neterr , ok := err .(net.Error ); ok && neterr .Timeout () {
9494 pluginsState .returnCode = PluginsReturnCodeServerTimeout
9595 } else {
@@ -125,8 +125,6 @@ func processDoHQuery(
125125 return response , nil
126126 }
127127
128- serverInfo .noticeFailure (proxy )
129-
130128 // Attempt to serve a stale response as a fallback.
131129 if stale , ok := pluginsState .sessionData ["stale" ]; ok {
132130 dlog .Debug ("Serving stale response" )
@@ -136,7 +134,8 @@ func processDoHQuery(
136134 }
137135 }
138136
139- // If no stale response was served, return the original error.
137+ // No stale response available; this is a definitive failure
138+ serverInfo .noticeFailure (proxy )
140139 pluginsState .returnCode = PluginsReturnCodeNetworkError
141140 pluginsState .ApplyLoggingPlugins (& proxy .pluginsGlobals )
142141 return nil , err
0 commit comments