From 3945a304e5162f3bf39347615254a746feb2eb0f Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 11 Oct 2010 23:54:53 +0300 Subject: now it must be secure, but only one encrypted filetransfer will work at same time, other will wait for it's done. --- utilities.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'utilities.cpp') diff --git a/utilities.cpp b/utilities.cpp index 0d51010..6d7fb58 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -278,6 +278,8 @@ struct file_in_transfer list transfers; +boost::mutex filetransfer_mutex; //currently safe to use only one encrypted fletransfers at same time + int onProtoAck(WPARAM w, LPARAM l) { ACKDATA *ack=(ACKDATA*)l; @@ -309,6 +311,7 @@ int onProtoAck(WPARAM w, LPARAM l) // if((*i)->thread == ccs) DeleteFile((*i)->file.c_str()); transfers.clear(); + filetransfer_mutex.unlock(); } // if(_tcsstr(f->tszCurrentFile, _T(".gpg"))) //ok, succesfuly sent, delete temporary file // DeleteFile(f->tszCurrentFile); @@ -365,6 +368,7 @@ int onSendFile(WPARAM w, LPARAM l) CCSDATA *ccs=(CCSDATA*)l; if(isContactSecured(ccs->hContact)) { + filetransfer_mutex.lock(); TCHAR **file=(TCHAR **)ccs->lParam; int i; for(i = 0; file[i]; i++) @@ -428,15 +432,6 @@ int onSendFile(WPARAM w, LPARAM l) return CallService(PSS_FILE, w, l); } -void temp_cleaner_thread() -{ - while(true) - { - list::iterator> elements_to_del; - Sleep(10000); - } -} - void storeOutput(HANDLE ahandle, string *output) { BOOL success; -- cgit v1.2.3