Skip to content

Commit

Permalink
p2p: remove unused code (ethereum#16158)
Browse files Browse the repository at this point in the history
* p2p: remove unused code

* p2p: remove unused imports
  • Loading branch information
divan authored and mariameda committed Aug 19, 2018
1 parent 274a594 commit c624813
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
26 changes: 0 additions & 26 deletions p2p/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"fmt"
"io"
"io/ioutil"
"net"
"sync"
"sync/atomic"
"time"

Expand Down Expand Up @@ -112,30 +110,6 @@ func SendItems(w MsgWriter, msgcode uint64, elems ...interface{}) error {
return Send(w, msgcode, elems)
}

// netWrapper wraps a MsgReadWriter with locks around
// ReadMsg/WriteMsg and applies read/write deadlines.
type netWrapper struct {
rmu, wmu sync.Mutex

rtimeout, wtimeout time.Duration
conn net.Conn
wrapped MsgReadWriter
}

func (rw *netWrapper) ReadMsg() (Msg, error) {
rw.rmu.Lock()
defer rw.rmu.Unlock()
rw.conn.SetReadDeadline(time.Now().Add(rw.rtimeout))
return rw.wrapped.ReadMsg()
}

func (rw *netWrapper) WriteMsg(msg Msg) error {
rw.wmu.Lock()
defer rw.wmu.Unlock()
rw.conn.SetWriteDeadline(time.Now().Add(rw.wtimeout))
return rw.wrapped.WriteMsg(msg)
}

// eofSignal wraps a reader with eof signaling. the eof channel is
// closed when the wrapped reader returns an error or when count bytes
// have been read.
Expand Down
4 changes: 1 addition & 3 deletions p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ import (
)

const (
defaultDialTimeout = 15 * time.Second
refreshPeersInterval = 30 * time.Second
staticPeerCheckInterval = 15 * time.Second
defaultDialTimeout = 15 * time.Second

// Connectivity defaults.
maxActiveDialTasks = 16
Expand Down

0 comments on commit c624813

Please sign in to comment.