Browse Source

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

Jelte Jansen 14 years ago
parent
commit
40623bbe96
2 changed files with 9 additions and 5 deletions
  1. 5 5
      src/bin/xfrout/xfrout.py.in
  2. 4 0
      src/lib/python/isc/cc/session.py

+ 5 - 5
src/bin/xfrout/xfrout.py.in

@@ -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)

+ 4 - 0
src/lib/python/isc/cc/session.py

@@ -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