Skip to content

Commit 97e4e25

Browse files
thinkAfCodGrapeBaBa
authored andcommitted
fix: utp close
1 parent 35ed45d commit 97e4e25

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ require (
5353
github.com/mattn/go-sqlite3 v1.14.18
5454
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416
5555
github.com/olekukonko/tablewriter v0.0.5
56-
github.com/optimism-java/utp-go v0.0.0-20241220063931-e7f66577a96c
56+
github.com/optimism-java/utp-go v0.0.0-20241223124724-19352018cc52
5757
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7
5858
github.com/pion/stun v0.6.1
5959
github.com/protolambda/bls12-381-util v0.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,8 @@ github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE=
421421
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
422422
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
423423
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
424-
github.com/optimism-java/utp-go v0.0.0-20241220063931-e7f66577a96c h1:eyOa3zWzO+RAQGWq6V91mgCybfsuROLJZxuQpY+/Nbg=
425-
github.com/optimism-java/utp-go v0.0.0-20241220063931-e7f66577a96c/go.mod h1:dJZNMUlyNpjM2VkUEHhmFprLei6gCg3r7U9qj9MmJNQ=
424+
github.com/optimism-java/utp-go v0.0.0-20241223124724-19352018cc52 h1:5wq4o4t/umlNii796cEwNyhIT6KefKZv0uUEE6OJjvA=
425+
github.com/optimism-java/utp-go v0.0.0-20241223124724-19352018cc52/go.mod h1:dJZNMUlyNpjM2VkUEHhmFprLei6gCg3r7U9qj9MmJNQ=
426426
github.com/optimism-java/zrnt v0.32.4-0.20240415084906-d9dbf06b32f7 h1:ZTQWXQ8xblCRUXhZs3h5qrBMSAHe8iNH7BG7a7IVFlI=
427427
github.com/optimism-java/zrnt v0.32.4-0.20240415084906-d9dbf06b32f7/go.mod h1:A0fezkp9Tt3GBLATSPIbuY4ywYESyAuc/FFmPKg8Lqs=
428428
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM=

p2p/discover/portal_protocol_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,11 @@ func TestTraceContentLookup(t *testing.T) {
493493

494494
// check response
495495
node3Response := res.Trace.Responses[node3Id]
496-
assert.Equal(t, node3Response.RespondedWith, []string{node2Id})
496+
assert.Equal(t, []string{node2Id}, node3Response.RespondedWith)
497497

498498
node2Response := res.Trace.Responses[node2Id]
499-
assert.Equal(t, node2Response.RespondedWith, []string{node1Id})
499+
assert.Equal(t, []string{node1Id}, node2Response.RespondedWith)
500500

501501
node1Response := res.Trace.Responses[node1Id]
502-
assert.Equal(t, node1Response.RespondedWith, ([]string)(nil))
502+
assert.Nil(t, node1Response.RespondedWith)
503503
}

p2p/discover/portal_utp.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ func (p *PortalUtp) Start() error {
8080
}
8181

8282
func (p *PortalUtp) Stop() {
83-
err := p.listener.Close()
84-
if err != nil {
85-
p.log.Error("close utp listener has error", "error", err)
83+
if p.listener != nil {
84+
err := p.listener.Close()
85+
if err != nil {
86+
p.log.Error("close utp listener has error", "error", err)
87+
}
8688
}
8789
p.discV5.Close()
8890
}

0 commit comments

Comments
 (0)