Skip to content

Commit fc4d2fd

Browse files
committed
disable the concurrent of tcp package handling
1 parent b2b952a commit fc4d2fd

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed

edgerouter.go

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ func Organize(name string, plugins ...interface{}) *EdgeRouter {
2626
paths := strings.Split(path, "/")
2727
er.Plugins[paths[len(paths)-1]] = plugin
2828
}
29-
fmt.Println("----")
3029
return er
3130
}
3231

math/parse_test.go

+20-20
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ func TestParse0(t *testing.T) {
99
1010
`)
1111
ds := Parse(tokens)
12-
if ds.Val(nil) != 30 {
13-
t.Error(ds.Val(nil), "not equals 30")
12+
if ds.Int(nil) != 30 {
13+
t.Error(ds.Int(nil), "not equals 30")
1414
}
1515
}
1616

@@ -21,8 +21,8 @@ func TestParse(t *testing.T) {
2121
2222
`)
2323
ds := Parse(tokens)
24-
if ds.Val(nil) != 24 {
25-
t.Error(ds.Val(nil), "not equals 24")
24+
if ds.Int(nil) != 24 {
25+
t.Error(ds.Int(nil), "not equals 24")
2626
}
2727
}
2828

@@ -33,8 +33,8 @@ func TestParse1(t *testing.T) {
3333
3434
`)
3535
ds := Parse(tokens)
36-
if ds.Val(nil) != 27 {
37-
t.Error(ds.Val(nil), "not equals 27")
36+
if ds.Int(nil) != 27 {
37+
t.Error(ds.Int(nil), "not equals 27")
3838
}
3939
}
4040

@@ -45,8 +45,8 @@ $1*6 - 3
4545
4646
`)
4747
ds := Parse(tokens)
48-
if ds.Val([]int{1}) != 3 {
49-
t.Error(ds.Val([]int{1}), "not equals 3")
48+
if ds.Int([]int{1}) != 3 {
49+
t.Error(ds.Int([]int{1}), "not equals 3")
5050
}
5151
}
5252

@@ -57,8 +57,8 @@ $1*$2 - 3
5757
5858
`)
5959
ds := Parse(tokens)
60-
if ds.Val([]int{1, 3}) != 0 {
61-
t.Error(ds.Val([]int{1, 3}), "not equals 0")
60+
if ds.Int([]int{1, 3}) != 0 {
61+
t.Error(ds.Int([]int{1, 3}), "not equals 0")
6262
}
6363
}
6464

@@ -69,8 +69,8 @@ $1* ($2 - 3)
6969
7070
`)
7171
ds := Parse(tokens)
72-
if ds.Val([]int{2, 4}) != 2 {
73-
t.Error(ds.Val([]int{2, 4}), "not equals 2")
72+
if ds.Int([]int{2, 4}) != 2 {
73+
t.Error(ds.Int([]int{2, 4}), "not equals 2")
7474
}
7575
}
7676

@@ -81,8 +81,8 @@ func TestParseClosure1(t *testing.T) {
8181
8282
`)
8383
ds := Parse(tokens)
84-
if ds.Val([]int{2, 4}) != 2 {
85-
t.Error(ds.Val([]int{2, 4}), "not equals 2")
84+
if ds.Int([]int{2, 4}) != 2 {
85+
t.Error(ds.Int([]int{2, 4}), "not equals 2")
8686
}
8787
}
8888

@@ -93,8 +93,8 @@ func TestParseClosure3(t *testing.T) {
9393
9494
`)
9595
ds := Parse(tokens)
96-
if ds.Val([]int{2, 4}) != 5 {
97-
t.Error(ds.Val([]int{2, 4}), "not equals 5")
96+
if ds.Int([]int{2, 4}) != 5 {
97+
t.Error(ds.Int([]int{2, 4}), "not equals 5")
9898
}
9999
}
100100

@@ -105,8 +105,8 @@ func TestParseClosure0(t *testing.T) {
105105
106106
`)
107107
ds := Parse(tokens)
108-
if ds.Val([]int{2, 4}) != 1 {
109-
t.Error(ds.Val([]int{2, 4}), "not equals 1")
108+
if ds.Int([]int{2, 4}) != 1 {
109+
t.Error(ds.Int([]int{2, 4}), "not equals 1")
110110
}
111111
}
112112

@@ -119,7 +119,7 @@ func TestParseClosure2(t *testing.T) {
119119
120120
`)
121121
ds := Parse(tokens)
122-
if ds.Val([]int{49, 48, 48, 48}) != 16 {
123-
t.Error(ds.Val([]int{49, 48, 48, 48}), "not equals 16")
122+
if ds.Int([]int{49, 48, 48, 48}) != 16 {
123+
t.Error(ds.Int([]int{49, 48, 48, 48}), "not equals 16")
124124
}
125125
}

tcp_server.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ func handleTcpConn(conn *net.TCPConn, handler TcpHandler) {
5555
return
5656
}
5757
if read_length > 0 {
58-
go panicWrapping(func() {
59-
handler.PacketReceived(data[0:read_length], conn)
60-
})
58+
handler.PacketReceived(data[0:read_length], conn)
6159
}
6260
}
6361
}

0 commit comments

Comments
 (0)