Age | Commit message (Collapse) | Author |
|
|
|
Closes #102.
|
|
Having to pass ConnectionData to each and every job class was nothing but boilerplate since the very beginning. Removing it required to prepend BaseJob::start() with ConnectionData-setting code, and to provide a way to alter the request configuration depending on the (late-coming) ConnectionData object. This is a new responsibility of BaseJob::start(); the previous BaseJob::start() contents have moved to BaseJob::sendRequest() (which is now invoked on retries, instead of start()).
|
|
Having to pass ConnectionData to each and every job class was nothing but boilerplate since the very beginning. Removing it required to prepend BaseJob::start() with ConnectionData-setting code, and to provide a way to alter the request configuration depending on the (late-coming) ConnectionData object. This is a new responsibility of BaseJob::start(); the previous BaseJob::start() contents have moved to BaseJob::sendRequest() (which is now invoked on retries, instead of start()).
|
|
|
|
Also: no reason to start the job timer if the request is not running, so don't even bother.
|
|
Your QT_LOGGING_RULES (especially useful with Qt 5.6 and newer) should
work a bit better now:
* "Job" prefix is no more needed because the Qt logging prefix
(libqmatrixclient.jobs) says it already;
* The "created" record didn't follow the logging category if overridden
from the concrete job class (see SyncJob); so instead of "created"
there's now much more useful "sending request" record.
|
|
It seems that some reply processing still might have happened after
BaseJob::abandon() (caused in turn by destroying a Connection object),
probably because the event from QNetworkReply landed in the event queue
after BaseJob::abandon() but before actual deletion of a job object. Now
countered by disconnecting from QNetworkReply signals in abandon() and
stop().
|
|
This reverts commit da975f68f6a8503bf5466292dcdceed8c6f7fa6f.
|
|
|
|
Code tweaks and cleanup
|
|
logging.h/logging.cpp is now a full-fledged pair for all things logging. Two more categories added, EPHEMERAL and SYNCJOB, that control logging for ephemeral events and SyncJob, respectively (in particular, switching off EPHEMERAL greatly reduces the logspam about moving read markers and how many users have read up to which event).
|
|
Before the access token was added to Private::requestQuery on every sendRequest() invocation, leading to the same access token being added up to the request once more with each retry.
|
|
Mainly it's about const-ification (in particular, passing const-refs instead of values) and deleting unneeded declarations/#includes. Since the changes alter the external interface, this is submitted as a PR for peer review.
One of unneeded declarations/definitions is a virtual destructor in BaseJob descendants. Since a job object should be deleted through QObject::deleteLater() anyway (and it's the only correct way of disposing of the object), all deletions will call the stack of destructors through virtual QObject::~QObject(). Therefore even BaseJob could get on with a non-virtual destructor but for the sake of clarity BaseJob::~BaseJob() is still declared virtual.
|
|
This greatly reduces the noise made by quaternion.
To enable full logging, export the following variable:
QT_LOGGING_RULES="libqmatrixclient.*.debug=true"
|
|
|
|
This is what /join returns if I supply garbage for the alias.
|
|
As of now, the retry logic (see BaseJob::finishJob() method) invokes the same network request several times with increasing timeouts and retry intervals. Some additional signals and accessors are also provided to control the behaviour from inheriting classes (see a notable example with SyncJob in the same commit) and clients (support of retries in Quaternion comes in a respective commit shortly).
|
|
This should help to provide more reasonable error messages when a particular resource is not found or entered data are outright incorrect.
|
|
data() in each job class
|
|
This should avoid timeout event catching up on a not-yet-deleted-but-
already-invalid job object.
|
|
accessors de-virtualized
Details:
- New: Connection::homeserver(), returns the homeserver URL from inside ConnectionData
- New/Modify: Connection::accessToken() and ConnectionData::accessToken() - because we will also have refresh tokens eventually; deprecate token() for the same reason
- Modify: Connection::user(), token(), accessToken() are no more virtual (they should have never been, these are plain accessors, after all)
|
|
|
|
return it
This better fixes the contract for derived job classes and simplifies error reporting. Methods error() and errorString() are kept for back-compatibility; status() returns a combination of them, conveniently packed into a Status object. For a quick status check, Status::good() is provided.
|
|
BaseJob
1. The externally (for derived classes) visible additions are checkReply() and parseReply() virtual methods, with gotReply becoming a mere dispatcher (and therefore a private method). Splitting gotReply() in that way allowed to remove boilerplate code from MediaThumbnailJob.
2. The internal tweak is using QScopedPointer<> to store pointers both to the Private object and to a QNetworkReply (with a special deleter that aborts the reply before destructing the object). This allows to remove desperate attempts to call reply->abort() wherever it's no more needed (and not aborting the in-flight replies seems to be a/the culprit of Quaternion after-exit hangs).
|
|
Some parts of the code were copied from the KCoreAddons sources - surprisingly few, in fact, mostly API with comments. With this commit, libqmatrixclient doesn't depend on KCoreAddons.
|
|
Due to signal-slot processing it's not obvious when exactly each job object is deleted.
|
|
well + stability fixes
1. Introduce ContentAccessDenied error code to BaseJob to allow clients to treat access denial errors differently from other network errors.
2. Since parseJson() overrides are responsible for calling emitResult(), the "default" BaseJob::parseJson() should call emitResult() as well.
3. Make sure BaseJob::fail() doesn't crash in absence of QNetworkReply.
|
|
data()
Thanks to CLang model.
|
|
And we don't need two log lines for timeouts.
|
|
|
|
|
|
destruction of the job
|
|
This is to facilitate processing of job results (see further commits).
|
|
|
|
|
|
1. Remove accidental trailing \
2. Show the contents of NetworkError in logs
|
|
|