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
50e096e6
Commit
50e096e6
authored
Apr 18, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
downloader: don't remove peers. keep them around
parent
03b4cf74
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
17 deletions
+17
-17
downloader.go
eth/downloader/downloader.go
+3
-2
handler.go
eth/handler.go
+11
-0
protocol_test.go
eth/protocol_test.go
+3
-15
No files found.
eth/downloader/downloader.go
View file @
50e096e6
...
...
@@ -176,6 +176,7 @@ out:
var
peer
*
peer
=
sync
.
peer
err
:=
d
.
getFromPeer
(
peer
,
sync
.
hash
,
sync
.
ignoreInitial
)
if
err
!=
nil
{
glog
.
V
(
logger
.
Detail
)
.
Infoln
(
err
)
break
}
...
...
@@ -301,7 +302,7 @@ out:
d
.
queue
.
reset
()
d
.
peers
.
reset
()
return
errPeersUnavailable
return
fmt
.
Errorf
(
"%v avaialable = %d. total = %d"
,
errPeersUnavailable
,
len
(
availablePeers
),
len
(
d
.
peers
))
}
}
else
if
len
(
d
.
queue
.
fetching
)
==
0
{
...
...
@@ -321,7 +322,7 @@ out:
if
time
.
Since
(
chunk
.
itime
)
>
blockTtl
{
badPeers
=
append
(
badPeers
,
pid
)
// remove peer as good peer from peer list
d
.
UnregisterPeer
(
pid
)
//
d.UnregisterPeer(pid)
}
}
d
.
queue
.
mu
.
Unlock
()
...
...
eth/handler.go
View file @
50e096e6
...
...
@@ -185,7 +185,16 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
if
request
.
Amount
>
maxHashes
{
request
.
Amount
=
maxHashes
}
hashes
:=
self
.
chainman
.
GetBlockHashesFromHash
(
request
.
Hash
,
request
.
Amount
)
if
glog
.
V
(
logger
.
Debug
)
{
if
len
(
hashes
)
==
0
{
glog
.
Infof
(
"invalid block hash %x"
,
request
.
Hash
.
Bytes
()[
:
4
])
}
}
// returns either requested hashes or nothing (i.e. not found)
return
p
.
sendBlockHashes
(
hashes
)
case
BlockHashesMsg
:
msgStream
:=
rlp
.
NewStream
(
msg
.
Payload
)
...
...
@@ -282,6 +291,7 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
return
nil
}
self
.
BroadcastBlock
(
hash
,
request
.
Block
)
fmt
.
Println
(
request
.
Block
.
Hash
()
.
Hex
(),
"our calculated TD ="
,
request
.
Block
.
Td
,
"their TD ="
,
request
.
TD
)
}
else
{
// adding blocks is synchronous
go
func
()
{
...
...
@@ -291,6 +301,7 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
return
}
self
.
BroadcastBlock
(
hash
,
request
.
Block
)
fmt
.
Println
(
request
.
Block
.
Hash
()
.
Hex
(),
"our calculated TD ="
,
request
.
Block
.
Td
,
"their TD ="
,
request
.
TD
)
}()
}
default
:
...
...
eth/protocol_test.go
View file @
50e096e6
package
eth
import
(
"log"
"math/big"
"os"
"testing"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/errs"
ethlogger
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
)
/*
TODO All of these tests need to be re-written
var logsys = ethlogger.NewStdLogSystem(os.Stdout, log.LstdFlags, ethlogger.LogLevel(ethlogger.DebugDetailLevel))
...
...
@@ -398,3 +385,4 @@ func TestTransactionsMsg(t *testing.T) {
eth.checkError(ErrDecode, delay)
}
*/
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