back to polygonf
git-svn-id: svn://db.shs.com.ru/pip@105 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -19,7 +19,7 @@ Daemon::Remote::Remote(const PIString & n): PIThread() {
|
||||
|
||||
Daemon::Remote::~Remote() {
|
||||
ft.stop();
|
||||
waitForFinish(1000);
|
||||
stop(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -283,6 +283,7 @@ void Daemon::fillInfoTile(const Daemon::HostInfo & hi) {
|
||||
|
||||
|
||||
void Daemon::tileEvent(PIScreenTile * t, TileEvent e) {
|
||||
PIMutexLocker ml(remote_mutex);
|
||||
if (t == list_daemons) {
|
||||
if (e.type == TileList::RowPressed) {
|
||||
connectToDaemon(list_daemons->content[e.data.toInt()].first);
|
||||
@@ -332,6 +333,7 @@ void Daemon::keyEvent(PIKbdListener::KeyEvent key) {
|
||||
|
||||
void Daemon::fmKeyEvent(PIKbdListener::KeyEvent key) {
|
||||
PIByteArray ba;
|
||||
PIMutexLocker ml(remote_mutex);
|
||||
//Remote * r = remotes.value(conn_name);
|
||||
//piCout << key.key << key.modifiers;
|
||||
switch (key.key) {
|
||||
@@ -448,6 +450,7 @@ void Daemon::peerConnected(const PIString & name) {
|
||||
CONNECTU(r, receiveFinished, this, closeFileDialog)
|
||||
CONNECTU(r, sendFinished, this, closeFileDialog)
|
||||
CONNECTU(r, removeFinished, this, filesRemoved)
|
||||
PIMutexLocker ml(remote_mutex);
|
||||
remotes.insert(name, r);
|
||||
}
|
||||
|
||||
@@ -456,6 +459,7 @@ void Daemon::peerDisconnected(const PIString & name) {
|
||||
if (name == conn_name) {
|
||||
disconnect();
|
||||
}
|
||||
PIMutexLocker ml(remote_mutex);
|
||||
Remote * dt = remotes.value(name, 0);
|
||||
if (!dt) return;
|
||||
if (tile_file_progress->ft == &(dt->ft)) {
|
||||
@@ -472,6 +476,7 @@ void Daemon::filesReceived(const PIString & name, bool ok) {
|
||||
|
||||
|
||||
void Daemon::filesRemoved(const PIString & name, const PIString & dir) {
|
||||
PIMutexLocker ml(remote_mutex);
|
||||
Remote * r = remotes.value(name, 0);
|
||||
if (!r) return;
|
||||
if (r->dir_my.absolutePath() != dir) return;
|
||||
@@ -500,8 +505,9 @@ void Daemon::closeFileDialog(const PIString & name, bool ok) {
|
||||
void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
//if (conn_name != from) return;
|
||||
if (data.size() < 4) return;
|
||||
PIMutexLocker ml(remote_mutex);
|
||||
PIByteArray ba(data), rba;
|
||||
Remote * r(0);
|
||||
Remote * r = remotes.value(from);
|
||||
PIString dir;
|
||||
int type; ba >> type;
|
||||
//piCout << "rec from " << from << type;
|
||||
@@ -511,7 +517,6 @@ void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
rba << int(ReplyHostInfo) << info_my;
|
||||
break;
|
||||
case RequestChangeDir:
|
||||
r = remotes.value(from);
|
||||
if (!r) break;
|
||||
ba >> dir;
|
||||
r->dir_my.cd(dir);
|
||||
@@ -526,7 +531,6 @@ void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
fillInfoTile(info_other);
|
||||
break;
|
||||
case ReplyChangeDir:
|
||||
r = remotes.value(from);
|
||||
if (!r) break;
|
||||
{
|
||||
PIVector<PIFile::FileInfo> fil;
|
||||
@@ -538,7 +542,6 @@ void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
}
|
||||
break;
|
||||
case CopyFiles:
|
||||
r = remotes.value(from);
|
||||
if (!r) return;
|
||||
if (r->isRunning()) return;
|
||||
{
|
||||
@@ -549,7 +552,6 @@ void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
}
|
||||
break;
|
||||
case RemoveFiles:
|
||||
r = remotes.value(from);
|
||||
if (!r) return;
|
||||
if (r->isRunning()) return;
|
||||
{
|
||||
@@ -561,7 +563,6 @@ void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
}
|
||||
break;
|
||||
case MkDir:
|
||||
r = remotes.value(from);
|
||||
if (!r) return;
|
||||
{
|
||||
PIString dn;
|
||||
@@ -572,7 +573,6 @@ void Daemon::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
}
|
||||
break;
|
||||
case FileTransfer:
|
||||
r = remotes.value(from);
|
||||
if (r) r->received(ba);
|
||||
break;
|
||||
};
|
||||
@@ -625,6 +625,9 @@ void Daemon::makeOtherHostInfo() {
|
||||
|
||||
void Daemon::requestChDir(const PIString & d) {
|
||||
if (d.isEmpty()) return;
|
||||
Remote * r = remotes.value(conn_name, 0);
|
||||
if (d.isEmpty()) return;
|
||||
if (!r) return;
|
||||
fm.remoteSaveDir();
|
||||
fm.readingRemote();
|
||||
PIByteArray ba;
|
||||
|
||||
Reference in New Issue
Block a user