git-svn-id: svn://db.shs.com.ru/pip@75 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2015-04-07 13:51:17 +00:00
parent 529b3c615f
commit b9021977e4
3 changed files with 12 additions and 3 deletions

View File

@@ -9,7 +9,7 @@ PIFileTransfer::PIFileTransfer() {
pftheader.session_id = 0;
pftheader.step = pft_None;
dir = PIDir::current();
is_sending = is_receiving = false;
started_ = false;
bytes_file_all = bytes_file_cur = 0;
// CONNECT(void, this, sendStarted, this, send_started);
CONNECT(void, this, receiveStarted, this, receive_started);
@@ -74,6 +74,7 @@ bool PIFileTransfer::sendFiles(const PIVector<PFTFileInfo> &files) {
}
srand(PISystemTime::current().toMilliseconds());
pftheader.session_id = rand();
started_ = true;
sendFilesStarted();
desc.clear();
desc << files_;
@@ -242,7 +243,8 @@ PIByteArray PIFileTransfer::customHeader() {
void PIFileTransfer::receive_started() {
if (pftheader.step == pft_None) {
files_.clear();
// piCoutObj << "start receive";
// piCoutObj << "start receive"
started_ = true;
receiveFilesStarted();
}
}
@@ -261,11 +263,13 @@ void PIFileTransfer::receive_finished(bool ok) {
}
if (!ok || !user_ok) {
pftheader.session_id--;
started_ = false;
receiveFilesFinished(false);
}
}
if (pftheader.step == pft_Data) {
work_file.close();
started_ = false;
receiveFilesFinished(ok);
}
}
@@ -273,6 +277,7 @@ void PIFileTransfer::receive_finished(bool ok) {
void PIFileTransfer::send_finished(bool ok) {
work_file.close();
started_ = false;
sendFilesFinished(ok);
}