Skip to content

Commit 6ea8906

Browse files
committed
Let's make linter happy
1 parent adce95a commit 6ea8906

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

network-api/network-api.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,6 @@ func tcpRead(ctx context.Context, rpc *msgpackrpc.Connection, params []any) (_re
247247
return nil, []any{1, "Invalid parameter type, expected int for timeout in ms"}
248248
} else if ms > 0 {
249249
deadline = time.Now().Add(time.Duration(ms) * time.Millisecond)
250-
} else if ms == 0 {
251-
// No timeout
252250
}
253251

254252
buffer := make([]byte, maxBytes)
@@ -431,14 +429,12 @@ func udpAwaitRead(ctx context.Context, rpc *msgpackrpc.Connection, params []any)
431429
return nil, []any{1, "Invalid parameter type, expected uint for UDP connection ID"}
432430
}
433431
var deadline time.Time // default value == no timeout
434-
if len(params) == 1 {
435-
// No timeout
436-
} else if ms, ok := msgpackrpc.ToInt(params[1]); !ok {
437-
return nil, []any{1, "Invalid parameter type, expected int for timeout in ms"}
438-
} else if ms > 0 {
439-
deadline = time.Now().Add(time.Duration(ms) * time.Millisecond)
440-
} else if ms == 0 {
441-
// No timeout
432+
if len(params) == 2 {
433+
if ms, ok := msgpackrpc.ToInt(params[1]); !ok {
434+
return nil, []any{1, "Invalid parameter type, expected int for timeout in ms"}
435+
} else if ms > 0 {
436+
deadline = time.Now().Add(time.Duration(ms) * time.Millisecond)
437+
}
442438
}
443439

444440
lock.RLock()

0 commit comments

Comments
 (0)