Commit 40623bbe authored by Jelte Jansen's avatar Jelte Jansen

changed print() calls in xfrout to sys.stderr.write

added an assertion check to _receive_full_buffer


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac312@2933 e5f2f494-b856-4b98-b285-d166d9295462
parent 68f83786
......@@ -315,8 +315,8 @@ class UnixSockServer(ThreadingUnixStreamServer):
If it's not a socket file or nobody is listening
, it will be removed. If it can't be removed, exit from python. '''
if self._sock_file_in_use(sock_file):
print("[b10-xfrout] Fail to start xfrout process, unix socket"
" file '%s' is being used by another xfrout process" % sock_file)
sys.stderr.write("[b10-xfrout] Fail to start xfrout process, unix socket"
" file '%s' is being used by another xfrout process\n" % sock_file)
sys.exit(0)
else:
if not os.path.exists(sock_file):
......@@ -325,7 +325,7 @@ class UnixSockServer(ThreadingUnixStreamServer):
try:
os.unlink(sock_file)
except OSError as err:
print('[b10-xfrout] Fail to remove file ' + sock_file, err)
sys.stderr.write('[b10-xfrout] Fail to remove file %s: %s' % (sock_file, err))
sys.exit(0)
def _sock_file_in_use(self, sock_file):
......@@ -527,10 +527,10 @@ if '__main__' == __name__:
except KeyboardInterrupt:
sys.stderr.write("[b10-xfrout] exit xfrout process")
except SessionError as e:
sys.stderr.write("[b10-xfrout] Error creating xfrout,"
sys.stderr.write("[b10-xfrout] Error creating xfrout, "
"is the command channel daemon running?")
except SessionTimeout as e:
sys.stderr.write("[b10-xfrout] Error creating xfrout,"
sys.stderr.write("[b10-xfrout] Error creating xfrout, "
"is the configuration manager running?")
except ModuleCCSessionError as e:
sys.stderr.write("info", '[b10-xfrout] exit xfrout process:', e)
......
......@@ -173,6 +173,10 @@ class Session:
# we might be in a call following an EAGAIN, in which case
# we simply continue. In the first case, either
# recv_size or recv_len size are not zero
# they may never both be non-zero (we are either starting
# a full read, or continuing one of the reads
assert self._recv_size == 0 or self._recv_len_size == 0
if self._recv_size == 0:
if self._recv_len_size == 0:
# both zero, start a new full read
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment