|
|
@ -20,7 +20,6 @@ import logging |
|
|
|
import socket |
|
|
|
import socket |
|
|
|
import struct |
|
|
|
import struct |
|
|
|
import sys |
|
|
|
import sys |
|
|
|
import time |
|
|
|
|
|
|
|
from threading import RLock, Thread |
|
|
|
from threading import RLock, Thread |
|
|
|
|
|
|
|
|
|
|
|
from test_framework.messages import * |
|
|
|
from test_framework.messages import * |
|
|
@ -208,7 +207,6 @@ class NodeConn(asyncore.dispatcher): |
|
|
|
self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) |
|
|
|
self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) |
|
|
|
self.sendbuf = b"" |
|
|
|
self.sendbuf = b"" |
|
|
|
self.recvbuf = b"" |
|
|
|
self.recvbuf = b"" |
|
|
|
self.last_sent = 0 |
|
|
|
|
|
|
|
self.state = "connecting" |
|
|
|
self.state = "connecting" |
|
|
|
self.network = net |
|
|
|
self.network = net |
|
|
|
self.cb = callback |
|
|
|
self.cb = callback |
|
|
@ -300,8 +298,6 @@ class NodeConn(asyncore.dispatcher): |
|
|
|
raise |
|
|
|
raise |
|
|
|
|
|
|
|
|
|
|
|
def got_message(self, message): |
|
|
|
def got_message(self, message): |
|
|
|
if self.last_sent + 30 * 60 < time.time(): |
|
|
|
|
|
|
|
self.send_message(MESSAGEMAP[b'ping']()) |
|
|
|
|
|
|
|
self._log_message("receive", message) |
|
|
|
self._log_message("receive", message) |
|
|
|
self.cb.deliver(self, message) |
|
|
|
self.cb.deliver(self, message) |
|
|
|
|
|
|
|
|
|
|
@ -353,7 +349,6 @@ class NodeConn(asyncore.dispatcher): |
|
|
|
self.sendbuf = tmsg |
|
|
|
self.sendbuf = tmsg |
|
|
|
else: |
|
|
|
else: |
|
|
|
self.sendbuf += tmsg |
|
|
|
self.sendbuf += tmsg |
|
|
|
self.last_sent = time.time() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Class utility methods |
|
|
|
# Class utility methods |
|
|
|
|
|
|
|
|
|
|
|