Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
7d5ff770
Commit
7d5ff770
authored
Aug 19, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p/discover: continue reading after temporary errors
Might solve #1579
parent
3b997c3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
udp.go
p2p/discover/udp.go
+11
-1
No files found.
p2p/discover/udp.go
View file @
7d5ff770
...
@@ -458,6 +458,10 @@ func encodePacket(priv *ecdsa.PrivateKey, ptype byte, req interface{}) ([]byte,
...
@@ -458,6 +458,10 @@ func encodePacket(priv *ecdsa.PrivateKey, ptype byte, req interface{}) ([]byte,
return
packet
,
nil
return
packet
,
nil
}
}
type
tempError
interface
{
Temporary
()
bool
}
// readLoop runs in its own goroutine. it handles incoming UDP packets.
// readLoop runs in its own goroutine. it handles incoming UDP packets.
func
(
t
*
udp
)
readLoop
()
{
func
(
t
*
udp
)
readLoop
()
{
defer
t
.
conn
.
Close
()
defer
t
.
conn
.
Close
()
...
@@ -467,7 +471,13 @@ func (t *udp) readLoop() {
...
@@ -467,7 +471,13 @@ func (t *udp) readLoop() {
buf
:=
make
([]
byte
,
1280
)
buf
:=
make
([]
byte
,
1280
)
for
{
for
{
nbytes
,
from
,
err
:=
t
.
conn
.
ReadFromUDP
(
buf
)
nbytes
,
from
,
err
:=
t
.
conn
.
ReadFromUDP
(
buf
)
if
err
!=
nil
{
if
tempErr
,
ok
:=
err
.
(
tempError
);
ok
&&
tempErr
.
Temporary
()
{
// Ignore temporary read errors.
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"Temporary read error: %v"
,
err
)
continue
}
else
if
err
!=
nil
{
// Shut down the loop for permament errors.
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"Read error: %v"
,
err
)
return
return
}
}
t
.
handlePacket
(
from
,
buf
[
:
nbytes
])
t
.
handlePacket
(
from
,
buf
[
:
nbytes
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment