From d8c270dcecc20b8084cb0463490ef68c8f88518f Mon Sep 17 00:00:00 2001 From: fcolin Date: Tue, 18 Apr 2006 11:54:14 +0000 Subject: retour au protocol V3 --- src/Makefile | 6 ++++-- src/Makefile.win32 | 3 +-- src/ivy.c | 16 ++++++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/Makefile b/src/Makefile index b3f6cd1..778da73 100644 --- a/src/Makefile +++ b/src/Makefile @@ -17,7 +17,7 @@ # change this in version.h too !!!! MAJOR=3 -MINOR=7 +MINOR=8 XTINC = -I/usr/X11R6/include XTLIB = -L/usr/X11R6/lib -lXt -lX11 -lSM -lICE @@ -68,12 +68,14 @@ REGEXP= -DUSE_PCRE_REGEX -DPCRE_OPT=$(PCRE_OPT) CHANNEL = -DTCL_CHANNEL_INTEGRATION CFLAGS = -g -Wall + OBJ = ivyloop.o timer.o ivysocket.o ivy.o GOBJ = ivyloop.o timer.o ivysocket.o givy.o XTOBJ = ivyxtloop.o ivysocket.o ivy.o GLIBOBJ = ivyglibloop.o ivysocket.o ivy.o GLUTOBJ = ivyglutloop.o ivysocket.o ivy.o TCLOBJ = ivytcl.o timer.o ivysocket.o givy.o + # WINDOWS add ivyloop.o if TCL_CHANNEL_INTEGRATION is not set TARGETS = ivyprobe ivyperf ivyglibprobe ivyxtprobe TARGETLIBS=libivy.so.$(MAJOR).$(MINOR) libgivy.so.$(MAJOR).$(MINOR) libxtivy.so.$(MAJOR).$(MINOR) libglibivy.so.$(MAJOR).$(MINOR) libtclivy.so.$(MAJOR).$(MINOR) @@ -99,7 +101,7 @@ ivy.o: ivy.c $(CC) -c $(CFLAGS) $(REGEXP) $(PCREINC) ivy.c givy.o: ivy.c - $(CC) -c $(CFLAGS) -DGNU_REGEXP -DREGCOMP_OPT=$(REGCOMP_OPT) -o givy.o ivy.c + $(CC) -c $(CFLAGS) $(REGEXP) -DREGCOMP_OPT=$(REGCOMP_OPT) -o givy.o ivy.c ivyglutloop.o: ivyglutloop.c ivyglutloop.h $(CC) -c $(CFLAGS) $(GLUTINC) ivyglutloop.c diff --git a/src/Makefile.win32 b/src/Makefile.win32 index dab95dd..52f024e 100755 --- a/src/Makefile.win32 +++ b/src/Makefile.win32 @@ -17,7 +17,7 @@ # change this in version.h too !!!! MAJOR=3 -MINOR=7 +MINOR=8 PCREINC = -I "C:\Program Files\GnuWin32\include" #`pcre-config --cflags` PCRELIB = "C:\Program Files\GnuWin32\lib\libpcre.lib" #`pcre-config --libs` @@ -45,7 +45,6 @@ REGEXP= -DUSE_PCRE_REGEX -DPCRE_OPT=$(PCRE_OPT) # see below CHANNEL = -DTCL_CHANNEL_INTEGRATION - OBJ = ivyloop.obj timer.obj ivysocket.obj ivy.obj # WINDOWS add ivyloop.obj if TCL_CHANNEL_INTEGRATION is not set diff --git a/src/ivy.c b/src/ivy.c index b8ac7fd..f03a4b1 100644 --- a/src/ivy.c +++ b/src/ivy.c @@ -229,6 +229,10 @@ MsgCall (const char *message, MsgSndPtr msg, Client client) static int MsgCall (const char *message, MsgSndPtr msg, Client client) { + static char *buffer = NULL; /* Use satic mem to eliminate multiple call to malloc /free */ + static int size = 0; /* donc non reentrant !!!! */ + int offset = 0; + regmatch_t match[MAX_MATCHING_ARGS+1]; #ifdef GNU_REGEXP regmatch_t* p; @@ -245,7 +249,7 @@ MsgCall (const char *message, MsgSndPtr msg, Client client) // il faut essayer d'envoyer le message en une seule fois sur la socket // pour eviter au maximun de passer dans le select plusieur fois par message du protocole Ivy // pour eviter la latence ( PB detecte par ivyperf ping roudtrip ) - SocketSendBuffered( client, "%d %d" ARG_START ,Msg, msg->id); + offset += make_message_var( &buffer, &size, offset, "%d %d" ARG_START ,Msg, msg->id); #ifdef DEBUG printf( "Send matching args count %ld\n",msg->regexp.re_nsub); @@ -254,7 +258,7 @@ MsgCall (const char *message, MsgSndPtr msg, Client client) #ifdef GNU_REGEXP p = &match[1]; while ( p->rm_so != -1 ) { - SocketSendBuffered( client, "%.*s" ARG_END , p->rm_eo - p->rm_so, + offset += make_message_var( &buffer, &size, offset, "%.*s" ARG_END , p->rm_eo - p->rm_so, message + p->rm_so); ++p; } @@ -266,10 +270,10 @@ MsgCall (const char *message, MsgSndPtr msg, Client client) printf ("Send matching arg%d %.*s\n",i,(int)(match[i].rm_eo - match[i].rm_so), message + match[i].rm_so); #endif - SocketSendBuffered (client, "%.*s" ARG_END ,(int)(match[i].rm_eo - match[i].rm_so), + offset += make_message_var( &buffer, &size, offset, "%.*s" ARG_END ,(int)(match[i].rm_eo - match[i].rm_so), message + match[i].rm_so); } else { - SocketSendBuffered (client, ARG_END); + offset += make_message_var( &buffer, &size, offset, ARG_END ); #ifdef DEBUG printf( "Send matching arg%d VIDE\n",i); #endif //DEBUG @@ -277,8 +281,8 @@ MsgCall (const char *message, MsgSndPtr msg, Client client) } #endif - SocketSendBuffered (client, "\n"); - SocketFlush(client); + offset += make_message_var( &buffer, &size, offset, "\n"); + SocketSendRaw(client, buffer , offset); return 1; } #endif /* USE_PCRE_REGEX */ -- cgit v1.1