git-svn-id: svn://db.shs.com.ru/pip@75 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -9,7 +9,7 @@ PIFileTransfer::PIFileTransfer() {
|
|||||||
pftheader.session_id = 0;
|
pftheader.session_id = 0;
|
||||||
pftheader.step = pft_None;
|
pftheader.step = pft_None;
|
||||||
dir = PIDir::current();
|
dir = PIDir::current();
|
||||||
is_sending = is_receiving = false;
|
started_ = false;
|
||||||
bytes_file_all = bytes_file_cur = 0;
|
bytes_file_all = bytes_file_cur = 0;
|
||||||
// CONNECT(void, this, sendStarted, this, send_started);
|
// CONNECT(void, this, sendStarted, this, send_started);
|
||||||
CONNECT(void, this, receiveStarted, this, receive_started);
|
CONNECT(void, this, receiveStarted, this, receive_started);
|
||||||
@@ -74,6 +74,7 @@ bool PIFileTransfer::sendFiles(const PIVector<PFTFileInfo> &files) {
|
|||||||
}
|
}
|
||||||
srand(PISystemTime::current().toMilliseconds());
|
srand(PISystemTime::current().toMilliseconds());
|
||||||
pftheader.session_id = rand();
|
pftheader.session_id = rand();
|
||||||
|
started_ = true;
|
||||||
sendFilesStarted();
|
sendFilesStarted();
|
||||||
desc.clear();
|
desc.clear();
|
||||||
desc << files_;
|
desc << files_;
|
||||||
@@ -242,7 +243,8 @@ PIByteArray PIFileTransfer::customHeader() {
|
|||||||
void PIFileTransfer::receive_started() {
|
void PIFileTransfer::receive_started() {
|
||||||
if (pftheader.step == pft_None) {
|
if (pftheader.step == pft_None) {
|
||||||
files_.clear();
|
files_.clear();
|
||||||
// piCoutObj << "start receive";
|
// piCoutObj << "start receive"
|
||||||
|
started_ = true;
|
||||||
receiveFilesStarted();
|
receiveFilesStarted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -261,11 +263,13 @@ void PIFileTransfer::receive_finished(bool ok) {
|
|||||||
}
|
}
|
||||||
if (!ok || !user_ok) {
|
if (!ok || !user_ok) {
|
||||||
pftheader.session_id--;
|
pftheader.session_id--;
|
||||||
|
started_ = false;
|
||||||
receiveFilesFinished(false);
|
receiveFilesFinished(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pftheader.step == pft_Data) {
|
if (pftheader.step == pft_Data) {
|
||||||
work_file.close();
|
work_file.close();
|
||||||
|
started_ = false;
|
||||||
receiveFilesFinished(ok);
|
receiveFilesFinished(ok);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,6 +277,7 @@ void PIFileTransfer::receive_finished(bool ok) {
|
|||||||
|
|
||||||
void PIFileTransfer::send_finished(bool ok) {
|
void PIFileTransfer::send_finished(bool ok) {
|
||||||
work_file.close();
|
work_file.close();
|
||||||
|
started_ = false;
|
||||||
sendFilesFinished(ok);
|
sendFilesFinished(ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public:
|
|||||||
void setDirectory(const PIString &path) {dir.setDir(path);}
|
void setDirectory(const PIString &path) {dir.setDir(path);}
|
||||||
PIDir directory() const {return dir;}
|
PIDir directory() const {return dir;}
|
||||||
|
|
||||||
|
bool isStarted() const {return started_;}
|
||||||
|
|
||||||
const PIString & curFile() const {return cur_file_string;}
|
const PIString & curFile() const {return cur_file_string;}
|
||||||
llong bytesFileAll() const {return bytes_file_all;}
|
llong bytesFileAll() const {return bytes_file_all;}
|
||||||
llong bytesFileCur() const {return bytes_file_cur;}
|
llong bytesFileCur() const {return bytes_file_cur;}
|
||||||
@@ -69,6 +71,7 @@ private:
|
|||||||
PIDir dir;
|
PIDir dir;
|
||||||
PIFile work_file;
|
PIFile work_file;
|
||||||
PIByteArray desc;
|
PIByteArray desc;
|
||||||
|
bool started_;
|
||||||
|
|
||||||
bool sendFiles(const PIVector<PFTFileInfo> &files);
|
bool sendFiles(const PIVector<PFTFileInfo> &files);
|
||||||
void processFile(int id, ullong start, PIByteArray &data);
|
void processFile(int id, ullong start, PIByteArray &data);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ private:
|
|||||||
bool quet_;
|
bool quet_;
|
||||||
|
|
||||||
void tick(void *, int) {
|
void tick(void *, int) {
|
||||||
if (ft.isSending() || ft.isReceiving()) {
|
if (ft.isStarted()) {
|
||||||
ftevent();
|
ftevent();
|
||||||
if (PIKbdListener::exiting) {
|
if (PIKbdListener::exiting) {
|
||||||
ft.stopSend();
|
ft.stopSend();
|
||||||
@@ -50,6 +50,7 @@ private:
|
|||||||
|
|
||||||
EVENT_HANDLER(void, ftevent) {
|
EVENT_HANDLER(void, ftevent) {
|
||||||
if (quet_) return;
|
if (quet_) return;
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
piCout
|
piCout
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user