Skip to content

Commit

Permalink
Handle tcp://* in message verification, and copy paste debug message …
Browse files Browse the repository at this point in the history
…cleaned up

Handle slot with fewer parameters
  • Loading branch information
PierreBizouard committed Apr 4, 2014
1 parent e430d87 commit 89d5e13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions pizco/protocol.py
Expand Up @@ -15,6 +15,7 @@
import hmac
import json
import hashlib
import re

if sys.version_info < (3, 0):
import cPickle as pickle
Expand Down Expand Up @@ -90,8 +91,8 @@ def _parse(self, key, message, check_sender=None, check_msgid=None):
if header != self.HEADER:
raise ValueError('Wrong header. In server: {}, received: {}'.format(self.HEADER, header))

if check_sender and check_sender != sender:
raise ValueError('Wrong Sender Sender. Sent: {}, received: {}'.format(check_sender, msgid))
if check_sender and check_sender != sender and sender.find("tcp://*") == -1:
raise ValueError('Wrong Sender Sender. Sent: {}, received: {}'.format(check_sender, sender))

if check_msgid and check_msgid != msgid:
raise ValueError('Wrong Message ID. Sent: {}, received: {}'.format(check_msgid, msgid))
Expand Down
8 changes: 5 additions & 3 deletions pizco/util.py
Expand Up @@ -13,11 +13,12 @@
class Signal(object):
"""PyQt like signal object
"""

def __init__(self):
#add dummy types for signals or hide a pyqtSignal behind to resync with qt main loop
self.slots = []

def connect(self, slot):
#add dummy connection type maybe this the place to create the pyqtSignals to be able to resync with qt event loop
if slot not in self.slots:
self.slots.append(slot)

Expand All @@ -28,9 +29,10 @@ def disconnect(self, slot=None):
self.slots.remove(slot)

def emit(self, *args):
#thread safety in qt main loop maybe pyqtSignals should be called behind
for slot in self.slots:
slot(*args)

argcount = slot.__code__.co_argcount
slot(*args[:argcount-1])

def bind(sock, endpoint='tcp://127.0.0.1:0'):
"""Bind socket to endpoint accepting a variety of endpoint formats.
Expand Down

0 comments on commit 89d5e13

Please sign in to comment.