Changed encoding and meta route index
Encoding is now BH (data type, route) which should be more than enough for now. Because H is not signed the meta route is now always on position 0.
This commit is contained in:
parent
2f17bd41ff
commit
d703f018b8
2 changed files with 6 additions and 4 deletions
|
@ -29,7 +29,9 @@ INVALID_METADATA_LAYOUT = 2
|
||||||
INVALID_DATA_TYPE = 3
|
INVALID_DATA_TYPE = 3
|
||||||
|
|
||||||
META_ROUTE = "meta"
|
META_ROUTE = "meta"
|
||||||
PACK_FORMAT = "Bh"
|
META_ROUTE_INDEX = 0
|
||||||
|
|
||||||
|
PACK_FORMAT = "BH"
|
||||||
|
|
||||||
|
|
||||||
class ConvertFailedError(ValueError):
|
class ConvertFailedError(ValueError):
|
||||||
|
@ -161,7 +163,7 @@ class Shared:
|
||||||
# Peer routes have not been received yet. As per convention the meta route
|
# Peer routes have not been received yet. As per convention the meta route
|
||||||
# has to exist and we need it for our first send to succeed (otherwise it
|
# has to exist and we need it for our first send to succeed (otherwise it
|
||||||
# would fail during route lookup).
|
# would fail during route lookup).
|
||||||
self.peer_exchange_routes = {-1 : META_ROUTE}
|
self.peer_exchange_routes = {META_ROUTE_INDEX : META_ROUTE}
|
||||||
self.peer_reverse_exchange_routes = reverse_dict(self.peer_exchange_routes)
|
self.peer_reverse_exchange_routes = reverse_dict(self.peer_exchange_routes)
|
||||||
try:
|
try:
|
||||||
self.post_opened()
|
self.post_opened()
|
||||||
|
|
|
@ -36,8 +36,8 @@ def launch_routes(created_routes, handler):
|
||||||
|
|
||||||
|
|
||||||
def create_exchange_map(routes):
|
def create_exchange_map(routes):
|
||||||
exchange_map = {-1 : "meta"}
|
exchange_map = {0 : "meta"}
|
||||||
exchange_id = 0
|
exchange_id = 1
|
||||||
for route in routes:
|
for route in routes:
|
||||||
if route != "meta":
|
if route != "meta":
|
||||||
exchange_map[exchange_id] = route
|
exchange_map[exchange_id] = route
|
||||||
|
|
Reference in a new issue