diff options
author | Ivan Daniluk <ivan.daniluk@gmail.com> | 2018-02-23 01:20:28 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-02-23 01:20:28 +0800 |
commit | 8522b312210865022618489a46db87df44923d4a (patch) | |
tree | b99236cad783a33d69ba60b804f7c94be17fb0ba /p2p/message.go | |
parent | 45352477933d71ec5055504da74547b0cdf0274b (diff) | |
download | dexon-8522b312210865022618489a46db87df44923d4a.tar dexon-8522b312210865022618489a46db87df44923d4a.tar.gz dexon-8522b312210865022618489a46db87df44923d4a.tar.bz2 dexon-8522b312210865022618489a46db87df44923d4a.tar.lz dexon-8522b312210865022618489a46db87df44923d4a.tar.xz dexon-8522b312210865022618489a46db87df44923d4a.tar.zst dexon-8522b312210865022618489a46db87df44923d4a.zip |
p2p: remove unused code (#16158)
* p2p: remove unused code
* p2p: remove unused imports
Diffstat (limited to 'p2p/message.go')
-rw-r--r-- | p2p/message.go | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/p2p/message.go b/p2p/message.go index 5690494bf..50b419970 100644 --- a/p2p/message.go +++ b/p2p/message.go @@ -22,8 +22,6 @@ import ( "fmt" "io" "io/ioutil" - "net" - "sync" "sync/atomic" "time" @@ -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. |