fix encoding issue
This commit is contained in:
parent
a2e22159b2
commit
1cbd909dc2
|
@ -57,6 +57,9 @@ class FloodSub(IPubsubRouter):
|
|||
"""
|
||||
|
||||
packet = rpc_pb2.RPC()
|
||||
print ("IN FLOOODSUB PUBLISH")
|
||||
print (message)
|
||||
print ("++++++++++++++++")
|
||||
packet.publish.extend([message])
|
||||
msg_sender = str(sender_peer_id)
|
||||
|
||||
|
|
|
@ -141,17 +141,21 @@ def generate_message_id():
|
|||
|
||||
def generate_RPC_packet(origin_id, topics, msg_content, msg_id):
|
||||
packet = rpc_pb2.RPC()
|
||||
packet.publish.extend([rpc_pb2.Message(
|
||||
message = rpc_pb2.Message(
|
||||
from_id=origin_id.encode('utf-8'),
|
||||
seqno=msg_id.encode('utf-8'),
|
||||
data=msg_content.encode('utf-8'),
|
||||
topicIDs=topics.encode('utf-8'))
|
||||
])
|
||||
data=msg_content.encode('utf-8')
|
||||
)
|
||||
|
||||
for topic in topics:
|
||||
message.topicIDs.extend([topic.encode('utf-8')])
|
||||
packet.subscriptions.extend([rpc_pb2.RPC.SubOpts(
|
||||
subscribe=True,
|
||||
topicid = topic.encode('utf-8')
|
||||
)])
|
||||
|
||||
packet.publish.extend([message])
|
||||
print ("HEYHO")
|
||||
print (packet)
|
||||
|
||||
return packet
|
||||
|
|
Loading…
Reference in New Issue
Block a user