aboutsummaryrefslogtreecommitdiff
path: root/hotline
diff options
context:
space:
mode:
Diffstat (limited to 'hotline')
-rw-r--r--hotline/files_test.go2
-rw-r--r--hotline/server.go4
-rw-r--r--hotline/tracker.go2
3 files changed, 4 insertions, 4 deletions
diff --git a/hotline/files_test.go b/hotline/files_test.go
index 0a7eb7b..9bed670 100644
--- a/hotline/files_test.go
+++ b/hotline/files_test.go
@@ -148,7 +148,7 @@ func TestCalcItemCount(t *testing.T) {
if err != nil {
t.Fatalf("Failed to create temp dir: %v", err)
}
- defer os.RemoveAll(tempDir)
+ defer func() { _ = os.RemoveAll(tempDir) }()
// Create the test directory structure
if err := createTestDirStructure(tempDir, tt.structure); err != nil {
diff --git a/hotline/server.go b/hotline/server.go
index 98b6132..19c7acc 100644
--- a/hotline/server.go
+++ b/hotline/server.go
@@ -235,7 +235,7 @@ func (s *Server) Serve(ctx context.Context, ln net.Listener) error {
})
s.Logger.Info("Connection established", "ip", ipAddr)
- defer conn.Close()
+ defer func() { _ = conn.Close() }()
// Check if we have an existing rate limit for the IP and create one if we do not.
rl, ok := s.rateLimiters[ipAddr]
@@ -247,7 +247,7 @@ func (s *Server) Serve(ctx context.Context, ln net.Listener) error {
// Check if the rate limit is exceeded and close the connection if so.
if !rl.Allow() {
s.Logger.Info("Rate limit exceeded", "RemoteAddr", conn.RemoteAddr())
- conn.Close()
+ _ = conn.Close()
return
}
diff --git a/hotline/tracker.go b/hotline/tracker.go
index 52963bf..edd973d 100644
--- a/hotline/tracker.go
+++ b/hotline/tracker.go
@@ -69,7 +69,7 @@ func register(dialer Dialer, tracker string, tr io.Reader) error {
if err != nil {
return fmt.Errorf("failed to dial tracker: %v", err)
}
- defer conn.Close()
+ defer func() { _ = conn.Close() }()
if _, err := io.Copy(conn, tr); err != nil {
return fmt.Errorf("failed to write to connection: %w", err)