(self)
| 423 | return True |
| 424 | |
| 425 | def bm_command_version(self): |
| 426 | self.remoteProtocolVersion, self.services, self.timestamp, self.sockNode, self.peerNode, self.nonce, \ |
| 427 | self.userAgent, self.streams = self.decode_payload_content("IQQiiQlsLv") |
| 428 | self.nonce = struct.pack('>Q', self.nonce) |
| 429 | self.timeOffset = self.timestamp - int(time.time()) |
| 430 | logger.debug("remoteProtocolVersion: %i", self.remoteProtocolVersion) |
| 431 | logger.debug("services: 0x%08X", self.services) |
| 432 | logger.debug("time offset: %i", self.timestamp - int(time.time())) |
| 433 | logger.debug("my external IP: %s", self.sockNode.host) |
| 434 | logger.debug("remote node incoming address: %s:%i", self.destination.host, self.peerNode.port) |
| 435 | logger.debug("user agent: %s", self.userAgent) |
| 436 | logger.debug("streams: [%s]", ",".join(map(str,self.streams))) |
| 437 | if not self.peerValidityChecks(): |
| 438 | # TODO ABORT |
| 439 | return True |
| 440 | #shared.connectedHostsList[self.destination] = self.streams[0] |
| 441 | self.append_write_buf(protocol.CreatePacket('verack')) |
| 442 | self.verackSent = True |
| 443 | if not self.isOutbound: |
| 444 | self.append_write_buf(protocol.assembleVersionMessage(self.destination.host, self.destination.port, \ |
| 445 | network.connectionpool.BMConnectionPool().streams, True, nodeid=self.nodeid)) |
| 446 | #print "%s:%i: Sending version" % (self.destination.host, self.destination.port) |
| 447 | if ((self.services & protocol.NODE_SSL == protocol.NODE_SSL) and |
| 448 | protocol.haveSSL(not self.isOutbound)): |
| 449 | self.isSSL = True |
| 450 | if self.verackReceived: |
| 451 | if self.isSSL: |
| 452 | self.set_state("tls_init", length=self.payloadLength, expectBytes=0) |
| 453 | return False |
| 454 | self.set_state("connection_fully_established", length=self.payloadLength, expectBytes=0) |
| 455 | return False |
| 456 | return True |
| 457 | |
| 458 | def peerValidityChecks(self): |
| 459 | if self.remoteProtocolVersion < 3: |
nothing calls this directly
no test coverage detected