- 9E41FDD532E857CEC8E4D3407560D8570B8E6B7B713739E6D81622B0A6ABCBE5A74A9E1CE70F192BE2CE5F5C2D0B2374E433BCB7A1D83E322C24460ADF92723A
+ AF78FE5EF8EC6919AE03EE8DA359DEBB290963F184560C69C7005D483819040E1D34C5E00E40092F1A962BFBC60922741018FEE44A8CB5764FCE8B594D29934D
blatta/lib/station.py
(55 . 16)(55 . 10)
463 self.deliver(message)
464 return
465
466 # if the speaker is in our wot, we need to check if the message is hearsay
467 if message.speaker in self.state.get_peer_handles():
468 # embargo to wait for immediate copy of message
469 else:
470 self.embargo(message)
471 return
472
473 else:
474 # skip the embargo and deliver this message with appropriate simple hearsay labeling
475 message.prefix = "%s[%s]" % (message.speaker, peer.handles[0])
476 self.deliver(message)
477 return
478 elif error_code == STALE_PACKET:
479 logging.debug("[%s:%d] -> stale packet: %s" % packet_info)
480 return
(93 . 18)(87 . 18)
482 def embargo(self, message):
483 # initialize the key/value to empty array if not in the hash
484 # append message to array
485 if not message.message_hash in self.embargo_queue.keys():
486 self.embargo_queue[message.message_hash] = []
487 self.embargo_queue[message.message_hash].append(message)
488 with self.embargo_queue_lock:
489 if not message.message_hash in self.embargo_queue.keys():
490 self.embargo_queue[message.message_hash] = []
491 self.embargo_queue[message.message_hash].append(message)
492
493 def check_embargo_queue(self):
494 # get a lock so other threads can't mess with the db or the queue
495 self.embargo_queue_lock.acquire()
496 self.check_for_immediate_messages()
497 self.flush_hearsay_messages()
498 with self.embargo_queue_lock:
499 self.check_for_immediate_messages()
500 self.flush_hearsay_messages()
501
502 # release the lock
503 self.embargo_queue_lock.release()
504 # release the lock
505
506 # continue the thread loop after interval
507 time.sleep(1)
(180 . 8)(174 . 7)
509
510 def send_rubbish(self):
511 logging.debug("sending rubbish...")
512 self.embargo_queue_lock.acquire()
513 try:
514 with self.embargo_queue_lock:
515 if self.client:
516 self.infosec.message(Message({
517 "speaker": self.client.nickname,
(189 . 8)(182 . 5)
519 "bounces": 0,
520 "body": self.infosec.gen_rubbish_body()
521 }))
522 except:
523 logging.error("Something went wrong attempting to send rubbish")
524 self.embargo_queue_lock.release()
525 time.sleep(RUBBISH_INTERVAL)
526 threading.Thread(target=self.send_rubbish).start()