Permalink
Browse files

the modulo was stupid, let it raise when value is too big

  • Loading branch information...
1 parent 42eec22 commit 2060f134ec65b60de6eccd3315bd833911707bf2 @rep committed Sep 8, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 cli/feed.py
View
@@ -20,12 +20,12 @@ def msghdr(op, data):
def msgpublish(ident, chan, data):
if isinstance(data, str):
data = data.encode('latin1')
- return msghdr(OP_PUBLISH, struct.pack('!B', len(ident)%0xff) + ident + struct.pack('!B', len(chan)%0xff) + chan + data)
+ return msghdr(OP_PUBLISH, struct.pack('!B', len(ident)) + ident + struct.pack('!B', len(chan)) + chan + data)
def msgsubscribe(ident, chan):
- return msghdr(OP_SUBSCRIBE, struct.pack('!B', len(ident)%0xff) + ident + chan)
+ return msghdr(OP_SUBSCRIBE, struct.pack('!B', len(ident)) + ident + chan)
def msgauth(rand, ident, secret):
hash = hashlib.sha1(rand+secret).digest()
- return msghdr(OP_AUTH, struct.pack('!B', len(ident)%0xff) + ident + hash)
+ return msghdr(OP_AUTH, struct.pack('!B', len(ident)) + ident + hash)
class FeedUnpack(object):
def __init__(self):

0 comments on commit 2060f13

Please sign in to comment.