Check explicitly for the 'no channels' case and
sleep instead, to avoid busy-waiting. (This is a work-
around, the underlying issue still be be traced)
void Client::update(int waitTimeout)
{
- d->poller.poll(waitTimeout);
- bool waitingRequests = !d->pendingRequests.empty();
+ if (!d->poller.hasChannels() && (waitTimeout > 0)) {
+ SGTimeStamp::sleepForMSec(waitTimeout);
+ } else {
+ d->poller.poll(waitTimeout);
+ }
+ bool waitingRequests = !d->pendingRequests.empty();
ConnectionDict::iterator it = d->connections.begin();
for (; it != d->connections.end(); ) {
Connection* con = it->second;
void updateFailed(HTTP::Request* req, SVNRepository::ResultCode err)
{
- SG_LOG(SG_IO, SG_WARN, "SVN: failed to update from:" << req->url());
+ SG_LOG(SG_IO, SG_WARN, "SVN: failed to update from:" << req->url()
+ << "\n(repository:" << p->baseUrl() << ")");
isUpdating = false;
status = err;
}
void addChannel(NetChannel* channel);
void removeChannel(NetChannel* channel);
+ bool hasChannels() const { return !channels.empty(); }
+
bool poll(unsigned int timeout = 0);
void loop(unsigned int timeout = 0);
};