(data)
| 401 | |
| 402 | |
| 403 | def _checkAndShareMsgWithPeers(data): |
| 404 | embeddedTime, = unpack('>Q', data[8:16]) |
| 405 | readPosition = 20 # bypass nonce, time, and object type |
| 406 | objectVersion, objectVersionLength = decodeVarint( |
| 407 | data[readPosition:readPosition + 9]) |
| 408 | readPosition += objectVersionLength |
| 409 | streamNumber, streamNumberLength = decodeVarint( |
| 410 | data[readPosition:readPosition + 9]) |
| 411 | if not streamNumber in state.streamsInWhichIAmParticipating: |
| 412 | logger.debug('The streamNumber %s isn\'t one we are interested in.' % streamNumber) |
| 413 | return |
| 414 | readPosition += streamNumberLength |
| 415 | inventoryHash = calculateInventoryHash(data) |
| 416 | if inventoryHash in Inventory(): |
| 417 | logger.debug('We have already received this msg message. Ignoring.') |
| 418 | return |
| 419 | # This msg message is valid. Let's let our peers know about it. |
| 420 | objectType = 2 |
| 421 | Inventory()[inventoryHash] = ( |
| 422 | objectType, streamNumber, data, embeddedTime,'') |
| 423 | logger.debug('advertising inv with hash: %s' % hexlify(inventoryHash)) |
| 424 | protocol.broadcastToSendDataQueues((streamNumber, 'advertiseobject', inventoryHash)) |
| 425 | |
| 426 | # Now let's enqueue it to be processed ourselves. |
| 427 | objectProcessorQueue.put((objectType,data)) |
| 428 | |
| 429 | def _checkAndShareGetpubkeyWithPeers(data): |
| 430 | if len(data) < 42: |
no test coverage detected