faubackup2/src/rsync rsync++_calls.cpp,1.5,1.6 rsync_wrapper.c,1.2,1.3

Erik Merkel <[email protected]> Sun, 26 Jun 2005 19:49:35 +0000
Newsgroups gmane.comp.sysutils.backup.faubackup.cvs
Message-ID <[email protected]>
Update of /cvsroot/faubackup/faubackup2/src/rsync
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30773/src/rsync

Modified Files:
	rsync++_calls.cpp rsync_wrapper.c 
Log Message:
corrected bug in rsync-buffer algo


Index: rsync_wrapper.c
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/rsync/rsync_wrapper.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rsync_wrapper.c	6 Jun 2005 19:45:08 -0000	1.2
--- rsync_wrapper.c	26 Jun 2005 19:49:33 -0000	1.3
***************
*** 31,34 ****
--- 31,36 ----
  	clearEOF(network);
  
+ 	rs_outbuflen = 32768;
+ 	rs_inbuflen = 32768;
  	if(!source_file)
  		return RS_IO_ERROR;
***************
*** 39,44 ****
  	out_fb = rs_filebuf_new2(NULL,network, rs_outbuflen);
  	result = rs_job_drive(job, &buf,
! 	                      in_fb ? rs_infilebuf_fill2 : NULL, in_fb,
! 	                      out_fb ? outnetwork_drain : NULL, out_fb);
  	if (in_fb) {
  		free(in_fb->buf);
--- 41,46 ----
  	out_fb = rs_filebuf_new2(NULL,network, rs_outbuflen);
  	result = rs_job_drive(job, &buf,
! 			      in_fb ? rs_infilebuf_fill2 : NULL, in_fb,
! 			      out_fb ? outnetwork_drain : NULL, out_fb);
  	if (in_fb) {
  		free(in_fb->buf);
***************
*** 50,54 ****
  		free(out_fb);
  	}
! 	putPackage(NULL, 0, 0, network);
  	sendEOF(network);
  	if(stats)
--- 52,56 ----
  		free(out_fb);
  	}
! 	/*putPackage(NULL, 0, 0, network);*/
  	sendEOF(network);
  	if(stats)
***************
*** 60,64 ****
  
  rs_result rdiff_delta(FILE *source_file, void *network_in, void *network_out,
!                       rs_stats_t *stats)
  {
  	rs_job_t        *job;
--- 62,66 ----
  
  rs_result rdiff_delta(FILE *source_file, void *network_in, void *network_out,
! 		      rs_stats_t *stats)
  {
  	rs_job_t        *job;
***************
*** 67,70 ****
--- 69,75 ----
  	rs_buffers_t    buf;
  	rs_filebuf_t    *in_fb = NULL, *out_fb = NULL;
+ 	rs_outbuflen = 32768;
+ 	rs_inbuflen = 32768;
+ 
  	clearEOF(network_in);
  	clearEOF(network_out);
***************
*** 89,97 ****
  	out_fb = rs_filebuf_new2(NULL, network_out ,rs_outbuflen);
  	result = rs_job_drive(job, &buf,
! 	                      in_fb ? rs_infilebuf_fill2 : NULL, in_fb,
! 	                      outnetwork_drain, out_fb);
  	/*sendEOF(network_out);*/
  
! 	/*putPackage(NULL, 0, 0, network_out);*/
  
  	clearEOF(network_in);
--- 94,102 ----
  	out_fb = rs_filebuf_new2(NULL, network_out ,rs_outbuflen);
  	result = rs_job_drive(job, &buf,
! 			      in_fb ? rs_infilebuf_fill2 : NULL, in_fb,
! 			      outnetwork_drain, out_fb);
  	/*sendEOF(network_out);*/
  
! 	putPackage(NULL, 0, 0, network_out);
  
  	clearEOF(network_in);
***************
*** 107,111 ****
  
  rs_result rdiff_patch(FILE *source_file, void *network_in,
!                       FILE *destination_file, rs_stats_t *stats)
  {
  	rs_job_t            *job;
--- 112,116 ----
  
  rs_result rdiff_patch(FILE *source_file, void *network_in,
! 		      FILE *destination_file, rs_stats_t *stats)
  {
  	rs_job_t            *job;
***************
*** 113,116 ****
--- 118,123 ----
  	rs_buffers_t    buf;
  	rs_filebuf_t    *in_fb = NULL, *out_fb = NULL;
+ 	rs_outbuflen = 32768;
+ 	rs_inbuflen = 32768;
  
  	clearEOF(network_in);
***************
*** 121,126 ****
  
  	result = rs_job_drive(job, &buf,
! 	                      innetwork_fill, in_fb,
! 	                      rs_outfilebuf_drain2, out_fb);
  	if (in_fb)
  		rs_filebuf_free2(in_fb);
--- 128,133 ----
  
  	result = rs_job_drive(job, &buf,
! 			      innetwork_fill, in_fb,
! 			      rs_outfilebuf_drain2, out_fb);
  	if (in_fb)
  		rs_filebuf_free2(in_fb);
***************
*** 161,166 ****
  		assert(buf->next_in >= fb->buf);
  		assert(buf->next_in <= fb->buf + fb->buf_len);
! 	}
! 	else {
  		assert(buf->avail_in == 0);
  	}
--- 168,172 ----
  		assert(buf->next_in >= fb->buf);
  		assert(buf->next_in <= fb->buf + fb->buf_len);
! 	} else {
  		assert(buf->avail_in == 0);
  	}
***************
*** 246,250 ****
   */
  rs_result rs_infilebuf_fill2(rs_job_t *job, rs_buffers_t *buf,
!                              void *opaque)
  {
  	int                     len;
--- 252,256 ----
   */
  rs_result rs_infilebuf_fill2(rs_job_t *job, rs_buffers_t *buf,
! 			     void *opaque)
  {
  	int                     len;
***************
*** 258,263 ****
  		assert(buf->next_in >= fb->buf);
  		assert(buf->next_in <= fb->buf + fb->buf_len);
! 	}
! 	else {
  		assert(buf->avail_in == 0);
  	}
--- 264,268 ----
  		assert(buf->next_in >= fb->buf);
  		assert(buf->next_in <= fb->buf + fb->buf_len);
! 	} else {
  		assert(buf->avail_in == 0);
  	}
***************
*** 287,292 ****
  			         strerror(errno));*/
  			return RS_IO_ERROR;
! 		}
! 		else {
  			/*rs_error("no error bit, but got %d return when trying to read",
  			         len);*/
--- 292,296 ----
  			         strerror(errno));*/
  			return RS_IO_ERROR;
! 		} else {
  			/*rs_error("no error bit, but got %d return when trying to read",
  			         len);*/

Index: rsync++_calls.cpp
===================================================================
RCS file: /cvsroot/faubackup/faubackup2/src/rsync/rsync++_calls.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rsync++_calls.cpp	14 Jun 2005 22:10:32 -0000	1.5
--- rsync++_calls.cpp	26 Jun 2005 19:49:33 -0000	1.6
***************
*** 15,22 ****
  	uint16_t length;
  	if(NetCommunicationPointer) {
- 
- 		//location =(char *) static_cast<faubackup::NetCommunication *>(NetCommunicationPointer)->readPackage(length, EoF);
  		static_cast<faubackup::NetCommunication *>(NetCommunicationPointer)->readPackage(location,length, EoF);
- 
  		*eof = EoF;
  		*size = length;
--- 15,19 ----
***************
*** 25,45 ****
  		*eof = 1;
  	}
- 
  }
  
  void putPackage(char * location, int length, int eof, void * NetCommunicationPointer)
  {
! 
! 	static_cast<faubackup::NetCommunication *>(NetCommunicationPointer)->sendPackage(location, length, eof);
! 	return;
  	static size_t bufsize = 0;
! 	static char buf[R_BUFSIZE+1] = {
! 	                                       0,0,
! 	                               };
  
  	if(NetCommunicationPointer) {
! 		if(location == NULL) {
  			if(bufsize)
! 				static_cast<faubackup::NetCommunication *>(NetCommunicationPointer)->sendPackage(buf, bufsize, true);
  			bufsize = 0;
  			return;
--- 22,39 ----
  		*eof = 1;
  	}
  }
  
  void putPackage(char * location, int length, int eof, void * NetCommunicationPointer)
  {
! 	//static_cast<faubackup::NetCommunication *>(NetCommunicationPointer)->sendPackage(location, length, eof);
  	static size_t bufsize = 0;
! 	static char buf[R_BUFSIZE] = {
! 					     0,0,
! 				     };
  
  	if(NetCommunicationPointer) {
! 		if((location == NULL) || (length == 0)) {
  			if(bufsize)
! 				static_cast<faubackup::NetCommunication *>(NetCommunicationPointer)->sendPackage(buf, bufsize, eof);
  			bufsize = 0;
  			return;
***************
*** 71,76 ****
  void sendEOF( void * NetCommunicationPointer)
  {
! 	if(NetCommunicationPointer)
  		return static_cast<faubackup::NetCommunication *>(NetCommunicationPointer)->sendEOF();
  }
  
--- 65,72 ----
  void sendEOF( void * NetCommunicationPointer)
  {
! 	if(NetCommunicationPointer) {
! 		putPackage(NULL, 0, false, NetCommunicationPointer);
  		return static_cast<faubackup::NetCommunication *>(NetCommunicationPointer)->sendEOF();
+ 	}
  }
  



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click