Changeset - a16eb3847e57
[Not reviewed]
default
0 3 0
Nathan Brink (binki) - 15 years ago 2010-07-31 01:12:43
ohnobinki@ohnopublishing.net
Quieter operation and dots to show upload progress for libdistren.
3 files changed with 17 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/client/libdistren.c
Show inline comments
 
@@ -130,6 +130,8 @@ int distren_submit_file(distren_t handle
 
  /* for basename() to play with */
 
  char *my_filename;
 

	
 
  size_t sendq_dots;
 

	
 
  errno = 0;
 
  in = fopen(filename, "r" FOPEN_BINARY);
 
  if(!in)
 
@@ -174,10 +176,15 @@ int distren_submit_file(distren_t handle
 

	
 
      /* ensure we have no more than a megabyte waiting to be sent. */
 
      while(handle->rem
 
	    && remoteio_sendq_len(handle->rem) / 3 > (1024 * 1024 / DISTREN_REQUEST_FILE_POST_DATA_LEN))
 
	    && (sendq_dots = remoteio_sendq_len(handle->rem) / 3) > (1024 * 1024 / DISTREN_REQUEST_FILE_POST_DATA_LEN))
 
	{
 
	  fprintf(stderr, "info: %d packets waiting to be sent...\n", remoteio_sendq_len(handle->rem) / 3);
 
	  multiio_poll(handle->multiio, -1);
 
	  if(handle->rem)
 
	    while(sendq_dots > remoteio_sendq_len(handle->rem) / 3)
 
	      {
 
		sendq_dots --;
 
		fputc('.', stderr);
 
	      }
 
	}
 
    }
 

	
 
@@ -197,11 +204,17 @@ int distren_submit_file(distren_t handle
 

	
 
  /* let's block until the file's gone. */
 
  while(handle->rem
 
	&& remoteio_sendq_len(handle->rem))
 
	&& (sendq_dots = remoteio_sendq_len(handle->rem)))
 
    {
 
      fprintf(stderr, "info: %d packets waiting to be sent...\n", remoteio_sendq_len(handle->rem) / 3);
 
      multiio_poll(handle->multiio, -1);
 
      if(handle->rem)
 
	while(sendq_dots / 3 > remoteio_sendq_len(handle->rem) / 3)
 
	  {
 
	    sendq_dots -= 3;
 
	    fputc('.', stderr);
 
	  }
 
    }
 
  fputc('\n', stderr);
 
  fprintf(stderr, "info: %s successfully uploaded, as far as we know.\n", filename);
 

	
 
  return 0;
src/common/remoteio.c
Show inline comments
 
@@ -430,9 +430,6 @@ int _remoteio_handle_write(multiio_conte
 

	
 
  int tmp;
 

	
 
  fprintf(stderr, "%s:%d: <del>My</del><ins>Someone else's</ins> traversal says that sock %d is available for writing\n",
 
	  __FILE__, __LINE__, fd);
 

	
 
  /*
 
   * check if we're out of stuff to write.
 
   */
src/server/mysql.c
Show inline comments
 
@@ -162,15 +162,12 @@ distrend_mysql_result_t mysqlQuery(distr
 
      return NULL;
 
    }
 

	
 
  fprintf(stderr,"Querying... ");
 
  if (mysql_query(conn->mysqlconn, query))
 
    {
 
      fprintf(stderr, "calling mysql_query() resulted in: %s\n", mysql_error(conn->mysqlconn));
 
      return NULL;
 
    }
 
  fprintf(stderr,"Queried!\n");
 

	
 
  fprintf(stderr,"Getting results... ");
 
  result = mysql_use_result(conn->mysqlconn);
 
  
 
  /**
0 comments (0 inline, 0 general)