File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,14 @@ package main
3
3
import (
4
4
"flag"
5
5
6
+ "fmt"
6
7
"log"
7
8
"math/rand"
8
9
"net"
9
10
"os"
10
11
"os/signal"
11
12
"syscall"
12
13
"time"
13
- "fmt"
14
14
)
15
15
16
16
// config vars, to be manipulated via command line flags
@@ -57,8 +57,10 @@ func (a *Agent) flush() error {
57
57
58
58
if ! cacheConns {
59
59
defer func () {
60
- a .Connection .Close ()
61
- a .Connection = nil
60
+ if a .Connection != nil {
61
+ a .Connection .Close ()
62
+ a .Connection = nil
63
+ }
62
64
}()
63
65
}
64
66
@@ -133,7 +135,7 @@ func main() {
133
135
134
136
if jitter .Nanoseconds () != 0 {
135
137
// rand(jitter * 2) - jitter gives random +/- jitter values
136
- jitterDelay = time .Duration (rand .Int63n (jitter .Nanoseconds () * 2 ) - jitter .Nanoseconds ())
138
+ jitterDelay = time .Duration (rand .Int63n (jitter .Nanoseconds ()* 2 ) - jitter .Nanoseconds ())
137
139
}
138
140
nextLaunch += jitterDelay
139
141
You can’t perform that action at this time.
0 commit comments