@@ -35,6 +35,7 @@ func init() {
35
35
}
36
36
37
37
type rainsResolver struct {}
38
+
38
39
var _ resolver = & rainsResolver {}
39
40
40
41
func (r * rainsResolver ) Resolve (ctx context.Context , name string ) (scionAddr , error ) {
@@ -46,7 +47,7 @@ func (r *rainsResolver) Resolve(ctx context.Context, name string) (scionAddr, er
46
47
// nobody to ask, so we won't get a reply
47
48
return scionAddr {}, HostNotFoundError {name }
48
49
}
49
- return rainsQuery (server , name )
50
+ return rainsQuery (ctx , server , name )
50
51
}
51
52
52
53
func readRainsConfig () (UDPAddr , error ) {
@@ -63,12 +64,12 @@ func readRainsConfig() (UDPAddr, error) {
63
64
return address , nil
64
65
}
65
66
66
- func rainsQuery (server UDPAddr , hostname string ) (scionAddr , error ) {
67
+ func rainsQuery (ctx context. Context , server UDPAddr , hostname string ) (scionAddr , error ) {
67
68
const (
68
- ctx = "." // use global context
69
- qType = rains .OTScionAddr // request SCION addresses
70
- expire = 5 * time .Minute // sensible expiry date?
71
- timeout = 500 * time .Millisecond // timeout for query
69
+ rainsCtx = "." // use global context
70
+ qType = rains .OTScionAddr // request SCION addresses
71
+ expire = 5 * time .Minute // sensible expiry date?
72
+ timeout = 500 * time .Millisecond // timeout for query
72
73
)
73
74
qOpts := []rains.Option {} // no options
74
75
@@ -78,7 +79,7 @@ func rainsQuery(server UDPAddr, hostname string) (scionAddr, error) {
78
79
// TODO(chaehni): This call can sometimes cause a timeout even though the server is reachable (see issue #221)
79
80
// The timeout value has been decreased to counter this behavior until the problem is resolved.
80
81
srv := server .snetUDPAddr ()
81
- reply , err := rains .Query (hostname , ctx , []rains.Type {qType }, qOpts , expire , timeout , srv )
82
+ reply , err := rains .Query (hostname , rainsCtx , []rains.Type {qType }, qOpts , expire , timeout , srv )
82
83
if err != nil {
83
84
return scionAddr {}, fmt .Errorf ("address for host %q not found: %w" , hostname , err )
84
85
}
0 commit comments