Skip to content

Commit 52ba27d

Browse files
committed
adjustments in pfstats for context
1 parent ad0ef79 commit 52ba27d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

go/stats/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (s radiustype) Test(source interface{}, ctx context.Context) {
9292
UserName_SetString(packet, "tim")
9393
UserPassword_SetString(packet, "12345")
9494
client := radius.DefaultClient
95-
ctx = context.WithTimeout(ctx, 5*time.Second)
95+
ctx, _ = context.WithTimeout(ctx, 5*time.Second)
9696
response, err := client.Exchange(ctx, packet, source.(pfconfigdriver.AuthenticationSourceRadius).Host+":"+source.(pfconfigdriver.AuthenticationSourceRadius).Port)
9797
if err != nil {
9898
StatsdClient.Gauge("source."+source.(pfconfigdriver.AuthenticationSourceRadius).Type+"."+source.(pfconfigdriver.AuthenticationSourceRadius).PfconfigHashNS, 0)
@@ -156,7 +156,7 @@ func (s eduroamtype) Test(source interface{}, ctx context.Context) {
156156
UserName_SetString(packet, "tim")
157157
UserPassword_SetString(packet, "12345")
158158
client := radius.DefaultClient
159-
ctx = context.WithTimeout(ctx, 5*time.Second)
159+
ctx, _ = context.WithTimeout(ctx, 5*time.Second)
160160
response, err := client.Exchange(ctx, packet, source.(pfconfigdriver.AuthenticationSourceEduroam).Server1Address+":1812")
161161

162162
if err != nil {
@@ -229,7 +229,6 @@ var StatsdClient *statsd.Client
229229
var ctx context.Context
230230

231231
func main() {
232-
d := time.Now().Add(500 * time.Millisecond)
233232
ctx := context.Background()
234233
ctx = log.LoggerNewContext(ctx)
235234

0 commit comments

Comments
 (0)