GH-1726 better failure detection for updates

Instead of just checking if the new version started, make sure
it is able to write its IPC key to a file and then use the key
to connect to the process.
This commit is contained in:
Petr Mrázek
2016-11-18 16:04:08 +01:00
parent e974950d48
commit 69be23c5f6
11 changed files with 553 additions and 329 deletions

View File

@ -52,8 +52,8 @@ QDebug operator<<(QDebug dbg, const Operation::Type &t)
QDebug operator<<(QDebug dbg, const Operation &u)
{
dbg.nospace() << "Operation(type=" << u.type << " file=" << u.file
<< " dest=" << u.dest << " mode=" << u.mode << ")";
dbg.nospace() << "Operation(type=" << u.type << " file=" << u.source
<< " dest=" << u.destination << " mode=" << u.destinationMode << ")";
return dbg.maybeSpace();
}

View File

@ -68,19 +68,22 @@ typedef QList<VersionFileEntry> VersionFileList;
*/
struct MULTIMC_LOGIC_EXPORT Operation
{
static Operation CopyOp(QString fsource, QString fdest, int fmode=0644)
static Operation CopyOp(QString from, QString to, int fmode=0644)
{
return Operation{OP_REPLACE, fsource, fdest, fmode};
return Operation{OP_REPLACE, from, to, fmode};
}
static Operation DeleteOp(QString file)
{
return Operation{OP_DELETE, file, "", 0644};
return Operation{OP_DELETE, QString(), file, 0644};
}
// FIXME: for some types, some of the other fields are irrelevant!
bool operator==(const Operation &u2) const
{
return type == u2.type && file == u2.file && dest == u2.dest && mode == u2.mode;
return type == u2.type &&
source == u2.source &&
destination == u2.destination &&
destinationMode == u2.destinationMode;
}
//! Specifies the type of operation that this is.
@ -90,14 +93,14 @@ struct MULTIMC_LOGIC_EXPORT Operation
OP_DELETE,
} type;
//! The file to operate on.
QString file;
//! The source file, if any
QString source;
//! The destination file.
QString dest;
QString destination;
//! The mode to change the source file to.
int mode;
//! The mode to change the destination file to.
int destinationMode;
};
typedef QList<Operation> OperationList;