BIND 10 trac2737, updated. 191f569b711f30366f584045e4cefd9211929ad8 [2737] Use the constants is isc.cc.session
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Mar 19 11:13:09 UTC 2013
The branch, trac2737 has been updated
via 191f569b711f30366f584045e4cefd9211929ad8 (commit)
from f687f77020bc9c4619915e7bb1d7f5a7c6c90ccc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 191f569b711f30366f584045e4cefd9211929ad8
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Mar 19 12:12:34 2013 +0100
[2737] Use the constants is isc.cc.session
-----------------------------------------------------------------------
Summary of changes:
src/lib/python/isc/cc/session.py | 43 ++++++++++++++++++++------------------
1 file changed, 23 insertions(+), 20 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/cc/session.py b/src/lib/python/isc/cc/session.py
index 036c078..2d5d5a7 100644
--- a/src/lib/python/isc/cc/session.py
+++ b/src/lib/python/isc/cc/session.py
@@ -57,11 +57,11 @@ class Session:
try:
self._socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self._socket.connect(self.socket_file)
- self.sendmsg({ "type": "getlname" })
+ self.sendmsg({ CC_HEADER_TYPE: CC_COMMAND_GET_LNAME })
env, msg = self.recvmsg(False)
if not env:
raise ProtocolError("Could not get local name")
- self._lname = msg["lname"]
+ self._lname = msg[CC_HEADER_LNAME]
if not self._lname:
raise ProtocolError("Could not get local name")
logger.debug(logger.DBGLVL_TRACE_BASIC, PYCC_LNAME_RECEIVED,
@@ -125,9 +125,10 @@ class Session:
if len(self._queue) > 0:
i = 0;
for env, msg in self._queue:
- if seq != None and "reply" in env and seq == env["reply"]:
+ if seq != None and CC_HEADER_REPLY in env and \
+ seq == env[CC_HEADER_REPLY]:
return self._queue.pop(i)
- elif seq == None and "reply" not in env:
+ elif seq == None and CC_HEADER_REPLY not in env:
return self._queue.pop(i)
else:
i = i + 1
@@ -141,7 +142,9 @@ class Session:
if data_length > 0:
env = isc.cc.message.from_wire(data[2:header_length+2])
msg = isc.cc.message.from_wire(data[header_length + 2:])
- if (seq == None and "reply" not in env) or (seq != None and "reply" in env and seq == env["reply"]):
+ if (seq == None and CC_HEADER_REPLY not in env) or \
+ (seq != None and CC_HEADER_REPLY in env and
+ seq == env[CC_HEADER_REPLY]):
return env, msg
else:
self._queue.append((env,msg))
@@ -248,18 +251,18 @@ class Session:
self._sequence += 1
return self._sequence
- def group_subscribe(self, group, instance = "*"):
+ def group_subscribe(self, group, instance=CC_INSTANCE_WILDCARD):
self.sendmsg({
- "type": "subscribe",
- "group": group,
- "instance": instance,
+ CC_HEADER_TYPE: CC_COMMAND_SUBSCRIBE,
+ CC_HEADER_GROUP: group,
+ CC_HEADER_INSTANCE: instance,
})
- def group_unsubscribe(self, group, instance = "*"):
+ def group_unsubscribe(self, group, instance=CC_INSTANCE_WILDCARD):
self.sendmsg({
- "type": "unsubscribe",
- "group": group,
- "instance": instance,
+ CC_HEADER_TYPE: CC_COMMAND_UNSUBSCRIBE,
+ CC_HEADER_GROUP: group,
+ CC_HEADER_INSTANCE: instance,
})
def group_sendmsg(self, msg, group, instance=CC_INSTANCE_WILDCARD,
@@ -308,13 +311,13 @@ class Session:
def group_reply(self, routing, msg):
seq = self._next_sequence()
self.sendmsg({
- "type": "send",
- "from": self._lname,
- "to": routing["from"],
- "group": routing["group"],
- "instance": routing["instance"],
- "seq": seq,
- "reply": routing["seq"],
+ CC_HEADER_TYPE: CC_COMMAND_SEND,
+ CC_HEADER_FROM: self._lname,
+ CC_HEADER_TO: routing[CC_HEADER_FROM],
+ CC_HEADER_GROUP: routing[CC_HEADER_GROUP],
+ CC_HEADER_INSTANCE: routing[CC_HEADER_INSTANCE],
+ CC_HEADER_SEQ: seq,
+ CC_HEADER_REPLY: routing[CC_HEADER_SEQ],
}, isc.cc.message.to_wire(msg))
return seq
More information about the bind10-changes
mailing list