aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'p2p/server.go')
-rw-r--r--p2p/server.go55
1 files changed, 0 insertions, 55 deletions
diff --git a/p2p/server.go b/p2p/server.go
index 7dcbc9d11..ee2d26dbe 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -8,7 +8,6 @@ import (
"sync"
"time"
- "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
)
@@ -356,25 +355,9 @@ func (srv *Server) dialLoop() {
// connect to peer via dial out
func (srv *Server) dialPeer(desc *peerAddr, slot int) {
srvlog.Debugf("Dialing %v (slot %d)\n", desc, slot)
- evd := map[string]interface{}{
- "remote_id": ethutil.Bytes2Hex(desc.Pubkey),
- "remote_endpoint": desc.String(),
- "level": "debug",
- "guid": ethutil.Bytes2Hex(srv.Identity.Pubkey()),
- "num_connections": srv.PeerCount(),
- }
- jsonlogger.LogJson("p2p.connecting", evd)
conn, err := srv.Dialer.Dial(desc.Network(), desc.String())
if err != nil {
srvlog.DebugDetailf("dial error: %v", err)
- evd := map[string]interface{}{
- "reason": "dial error",
- "remote_id": desc.String(),
- "level": "debug",
- "guid": ethutil.Bytes2Hex(srv.Identity.Pubkey()),
- "num_connections": srv.PeerCount(),
- }
- jsonlogger.LogJson("p2p.disconnecting", evd)
srv.peerSlots <- slot
return
}
@@ -395,13 +378,6 @@ func (srv *Server) addPeer(conn net.Conn, desc *peerAddr, slot int) *Peer {
srv.peers[slot] = peer
srv.peerCount++
go func() {
- evd := map[string]interface{}{
- "guid": ethutil.Bytes2Hex(srv.Identity.Pubkey()),
- "num_connections": srv.PeerCount(),
- "remote_id": desc.String(),
- "level": "debug",
- }
- jsonlogger.LogJson("p2p.connected", evd)
peer.loop()
srv.peerDisconnect <- peer
}()
@@ -422,36 +398,13 @@ func (srv *Server) removePeer(peer *Peer) {
srv.peers[peer.slot] = nil
// release slot to signal need for a new peer, last!
srv.peerSlots <- peer.slot
- evd := map[string]interface{}{
- "guid": ethutil.Bytes2Hex(srv.Identity.Pubkey()),
- "num_connections": srv.PeerCount(),
- "remote_id": ethutil.Bytes2Hex(peer.Identity().Pubkey()),
- "level": "debug",
- }
- jsonlogger.LogJson("p2p.disconnected", evd)
}
func (srv *Server) verifyPeer(addr *peerAddr) error {
if srv.Blacklist.Exists(addr.Pubkey) {
- evd := map[string]interface{}{
- "reason": "blacklisted",
- "remote_id": addr.String(),
- "level": "debug",
- "guid": ethutil.Bytes2Hex(srv.Identity.Pubkey()),
- "num_connections": srv.PeerCount(),
- }
- jsonlogger.LogJson("p2p.disconnecting.reputation", evd)
return errors.New("blacklisted")
}
if bytes.Equal(srv.Identity.Pubkey()[1:], addr.Pubkey) {
- evd := map[string]interface{}{
- "reason": "not allowed to connect to srv",
- "remote_id": addr.String(),
- "level": "debug",
- "guid": ethutil.Bytes2Hex(srv.Identity.Pubkey()),
- "num_connections": srv.PeerCount(),
- }
- jsonlogger.LogJson("p2p.disconnecting", evd)
return newPeerError(errPubkeyForbidden, "not allowed to connect to srv")
}
srv.lock.RLock()
@@ -460,14 +413,6 @@ func (srv *Server) verifyPeer(addr *peerAddr) error {
if peer != nil {
id := peer.Identity()
if id != nil && bytes.Equal(id.Pubkey(), addr.Pubkey) {
- evd := map[string]interface{}{
- "reason": "already connected",
- "remote_id": addr.String(),
- "level": "debug",
- "guid": ethutil.Bytes2Hex(srv.Identity.Pubkey()),
- "num_connections": srv.PeerCount(),
- }
- jsonlogger.LogJson("p2p.disconnecting", evd)
return errors.New("already connected")
}
}