changeset 14719:c19de7f32961 stable

cmdserver: write the hello message as one chunk on the 'o' channel This is a guaranteed by the protocol: clients know they need to read one chunk off of the 'o' channel and treat that as the hello message. They should ignore fields they don't recognize so they stay compatible with new versions of the server in case we decide to add something.
author Idan Kamara <idankk86@gmail.com>
date Wed, 22 Jun 2011 17:13:04 +0300
parents 0c81948636f3
children 36283a7b6856
files mercurial/commandserver.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commandserver.py	Fri Jun 24 01:10:35 2011 +0200
+++ b/mercurial/commandserver.py	Wed Jun 22 17:13:04 2011 +0300
@@ -205,8 +205,12 @@
                     'getencoding' : getencoding}
 
     def serve(self):
-        self.cout.write('capabilities: %s' % ' '.join(self.capabilities.keys()))
-        self.cout.write('encoding: %s' % encoding.encoding)
+        hellomsg = 'capabilities: ' + ' '.join(self.capabilities.keys())
+        hellomsg += '\n'
+        hellomsg += 'encoding: ' + encoding.encoding
+
+        # write the hello msg in -one- chunk
+        self.cout.write(hellomsg)
 
         try:
             while self.serveone():