(0 . 0)(1 . 30)
1113 import logging
1114 import time
1115 import hashlib
1116 import os
1117 from message import Message
1118 from message import IGNORE
1119
1120
1121 class Ignore(Message):
1122 def __init__(self, message, state):
1123 message['command'] = IGNORE
1124 message['bounces'] = 0
1125 message['body'] = self.gen_rubbish_body()
1126 super(Ignore, self).__init__(message, state)
1127
1128 def send(self):
1129 if not self.speaker:
1130 logging.error("aborting message send due speaker not being set")
1131 return
1132
1133 # if we are not rebroadcasting we need to set the timestamp
1134 self.timestamp = int(time.time())
1135 self.message_bytes = self.get_message_bytes()
1136 self.message_hash = hashlib.sha256(self.message_bytes).digest()
1137
1138 for peer in self.state.get_keyed_peers(exclude_addressless=True):
1139 signed_packet_bytes = self.pack(peer, self.command, self.bounces, self.message_bytes)
1140 peer.send(signed_packet_bytes)
1141 if os.environ.get('LOG_RUBBISH'):
1142 self.log_rubbish(peer)