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.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);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
void setDirectory(const PIString &path) {dir.setDir(path);}
|
||||
PIDir directory() const {return dir;}
|
||||
|
||||
bool isStarted() const {return started_;}
|
||||
|
||||
const PIString & curFile() const {return cur_file_string;}
|
||||
llong bytesFileAll() const {return bytes_file_all;}
|
||||
llong bytesFileCur() const {return bytes_file_cur;}
|
||||
@@ -69,6 +71,7 @@ private:
|
||||
PIDir dir;
|
||||
PIFile work_file;
|
||||
PIByteArray desc;
|
||||
bool started_;
|
||||
|
||||
bool sendFiles(const PIVector<PFTFileInfo> &files);
|
||||
void processFile(int id, ullong start, PIByteArray &data);
|
||||
|
||||
@@ -38,7 +38,7 @@ private:
|
||||
bool quet_;
|
||||
|
||||
void tick(void *, int) {
|
||||
if (ft.isSending() || ft.isReceiving()) {
|
||||
if (ft.isStarted()) {
|
||||
ftevent();
|
||||
if (PIKbdListener::exiting) {
|
||||
ft.stopSend();
|
||||
@@ -50,6 +50,7 @@ private:
|
||||
|
||||
EVENT_HANDLER(void, ftevent) {
|
||||
if (quet_) return;
|
||||
|
||||
#ifdef WINDOWS
|
||||
piCout
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user