MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestClientConnLimiter_Add

Function TestClientConnLimiter_Add

internal/nodes/client_conn_limiter_test.go:10–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestClientConnLimiter_Add(t *testing.T) {
11 var limiter = NewClientConnLimiter()
12 {
13 b := limiter.Add("127.0.0.1:1234", 1, "192.168.1.100", 10, 5)
14 t.Log(b)
15 }
16 {
17 b := limiter.Add("127.0.0.1:1235", 1, "192.168.1.100", 10, 5)
18 t.Log(b)
19 }
20 {
21 b := limiter.Add("127.0.0.1:1236", 1, "192.168.1.100", 10, 5)
22 t.Log(b)
23 }
24 {
25 b := limiter.Add("127.0.0.1:1237", 1, "192.168.1.101", 10, 5)
26 t.Log(b)
27 }
28 {
29 b := limiter.Add("127.0.0.1:1238", 1, "192.168.1.100", 5, 5)
30 t.Log(b)
31 }
32 limiter.Remove("127.0.0.1:1238")
33 limiter.Remove("127.0.0.1:1239")
34 limiter.Remove("127.0.0.1:1237")
35 logs.PrintAsJSON(limiter.remoteAddrMap, t)
36 logs.PrintAsJSON(limiter.ipConns, t)
37 logs.PrintAsJSON(limiter.serverConns, t)
38}

Callers

nothing calls this directly

Calls 4

NewClientConnLimiterFunction · 0.85
LogMethod · 0.80
AddMethod · 0.65
RemoveMethod · 0.65

Tested by

no test coverage detected