Update of /cvsroot/monetdb/MonetDB5/src/modules/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16596/src/modules/mal

Modified Files:
      Tag: MonetDB_5-0
        clients.mx mserver.mx 
Log Message:
add end of string for the received responds in the client/server startup

clients are by default killed after a small timeout (PROCESSTIMEOUT). 
Lets hope this finishes the random crashes (of M5/sql).


Index: clients.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/clients.mx,v
retrieving revision 1.61
retrieving revision 1.61.2.1
diff -u -d -r1.61 -r1.61.2.1
--- clients.mx  4 Apr 2007 20:33:38 -0000       1.61
+++ clients.mx  7 Jun 2007 20:24:37 -0000       1.61.2.1
@@ -341,7 +341,7 @@
 }
 str
 CLTquitDefault(int *ret){
-       int timeout = 0;
+       int timeout = PROCESSTIMEOUT;
        return CLTquit(ret,&timeout);
 }
 

Index: mserver.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/mserver.mx,v
retrieving revision 1.87
retrieving revision 1.87.2.1
diff -u -d -r1.87 -r1.87.2.1
--- mserver.mx  29 May 2007 21:01:28 -0000      1.87
+++ mserver.mx  7 Jun 2007 20:24:38 -0000       1.87.2.1
@@ -426,12 +426,13 @@
 static void 
 doChallenge(str cmd, stream *in, stream *out) {
        if (cmd == NULL) {
-               char *buf = (char *) GDKmalloc(BLOCK);
+               char *buf = (char *) GDKmalloc(BLOCK + 1);
                char *challenge;
                char *algos;
                stream *fdin = block_stream(in);
                stream *fdout = block_stream(out);
                bstream *bs;
+               int len = 0;
 
                if (!fdin || !fdout) {
                        GDKsyserror("SERVERlisten:fdin or fdout problems");
@@ -456,16 +457,16 @@
                                );
                stream_flush(fdout);
                /* get response */
-               stream_read_block(fdin, buf, BLOCK, 1);
-
-               /* in embedded mode we allow just one client */
-               if (GDKembedded && MCcountClients() > 1) {
+               if ((len = stream_read_block(fdin, buf, 1, BLOCK)) < 0 || 
+                       /* in embedded mode we allow just one client */
+                       (GDKembedded && MCcountClients() > 1)) {
                        stream_close(fdin);
                        stream_destroy(fdin);
                        stream_close(fdout);
                        stream_destroy(fdout);
                        return;
                }
+               buf[len] = 0;
 #ifdef DEBUG_SERVER
                printf("mserver:Client accepted %s\n", name);
                fflush(stdout);


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to