bgsave: have a single source for InputProcessing enable & disable.
Somehow this state can get confused in a bgsave process: Kit Document: ... inputProcessingEnabled: false ... SocketPoll: Poll [kit] with 1 socket - wakeup rfd: 39 wfd: 45 fd events rbuffered wbuffered rtotal wtotal 52 0x1 process 0 0 r: 825 'process' should read 'ignore' for disabled input. Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Change-Id: I787eebe6fda3ae1b527d7605b8813fa764e81890pull/8816/head
parent
bd6d48b022
commit
f845ac08af
14
kit/Kit.cpp
14
kit/Kit.cpp
|
@ -711,7 +711,6 @@ Document::Document(const std::shared_ptr<lok::Office>& loKit,
|
||||||
_editorChangeWarning(false),
|
_editorChangeWarning(false),
|
||||||
_lastMemTrimTime(std::chrono::steady_clock::now()),
|
_lastMemTrimTime(std::chrono::steady_clock::now()),
|
||||||
_mobileAppDocId(mobileAppDocId),
|
_mobileAppDocId(mobileAppDocId),
|
||||||
_inputProcessingEnabled(true),
|
|
||||||
_duringLoad(0)
|
_duringLoad(0)
|
||||||
{
|
{
|
||||||
LOG_INF("Document ctor for [" << _docKey <<
|
LOG_INF("Document ctor for [" << _docKey <<
|
||||||
|
@ -2090,13 +2089,12 @@ void Document::checkIdle()
|
||||||
ProcessToIdleDeadline = std::chrono::steady_clock::now() - std::chrono::milliseconds(10);
|
ProcessToIdleDeadline = std::chrono::steady_clock::now() - std::chrono::milliseconds(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::enableProcessInput(bool enable)
|
bool Document::processInputEnabled() const
|
||||||
{
|
{
|
||||||
LOG_TRC("Document - input processing now: " <<
|
bool enabled = !_websocketHandler || _websocketHandler->processInputEnabled();
|
||||||
(enable ? "enabled" : "disabled") <<
|
if (!enabled)
|
||||||
" was " <<
|
LOG_TRC("Document - not processing input");
|
||||||
(_inputProcessingEnabled ? "enabled" : "disabled"));
|
return enabled;
|
||||||
_inputProcessingEnabled = enable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::drainQueue()
|
void Document::drainQueue()
|
||||||
|
@ -2285,7 +2283,7 @@ void Document::dumpState(std::ostream& oss)
|
||||||
<< "\n\teditorId: " << _editorId
|
<< "\n\teditorId: " << _editorId
|
||||||
<< "\n\teditorChangeWarning: " << _editorChangeWarning
|
<< "\n\teditorChangeWarning: " << _editorChangeWarning
|
||||||
<< "\n\tmobileAppDocId: " << _mobileAppDocId
|
<< "\n\tmobileAppDocId: " << _mobileAppDocId
|
||||||
<< "\n\tinputProcessingEnabled: " << _inputProcessingEnabled
|
<< "\n\tinputProcessingEnabled: " << processInputEnabled()
|
||||||
<< "\n\tduringLoad: " << _duringLoad
|
<< "\n\tduringLoad: " << _duringLoad
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
|
|
|
@ -374,8 +374,7 @@ private:
|
||||||
bool isTileRequestInsideVisibleArea(const TileCombined& tileCombined);
|
bool isTileRequestInsideVisibleArea(const TileCombined& tileCombined);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void enableProcessInput(bool enable = true);
|
bool processInputEnabled() const;
|
||||||
bool processInputEnabled() const { return _inputProcessingEnabled; }
|
|
||||||
bool hasQueueItems() const { return _tileQueue && !_tileQueue->isEmpty(); }
|
bool hasQueueItems() const { return _tileQueue && !_tileQueue->isEmpty(); }
|
||||||
|
|
||||||
// poll is idle, are we ?
|
// poll is idle, are we ?
|
||||||
|
@ -453,7 +452,6 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const unsigned _mobileAppDocId;
|
const unsigned _mobileAppDocId;
|
||||||
bool _inputProcessingEnabled;
|
|
||||||
int _duringLoad;
|
int _duringLoad;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -157,9 +157,11 @@ void KitWebSocketHandler::handleMessage(const std::vector<char>& data)
|
||||||
|
|
||||||
void KitWebSocketHandler::enableProcessInput(bool enable)
|
void KitWebSocketHandler::enableProcessInput(bool enable)
|
||||||
{
|
{
|
||||||
|
LOG_TRC("Kit socket - input processing now: " <<
|
||||||
|
(enable ? "enabled" : "disabled") <<
|
||||||
|
" was " <<
|
||||||
|
(WebSocketHandler::processInputEnabled() ? "enabled" : "disabled"));
|
||||||
WebSocketHandler::enableProcessInput(enable);
|
WebSocketHandler::enableProcessInput(enable);
|
||||||
if (_document)
|
|
||||||
_document->enableProcessInput(enable);
|
|
||||||
|
|
||||||
// Wake up poll to process data from socket input buffer
|
// Wake up poll to process data from socket input buffer
|
||||||
if (enable && _ksPoll)
|
if (enable && _ksPoll)
|
||||||
|
|
|
@ -691,6 +691,15 @@ public:
|
||||||
return sendFrame(socket, data, len, WSFrameMask::Fin | static_cast<unsigned char>(code), flush);
|
return sendFrame(socket, data, len, WSFrameMask::Fin | static_cast<unsigned char>(code), flush);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool processInputEnabled() const override
|
||||||
|
{
|
||||||
|
std::shared_ptr<StreamSocket> socket = _socket.lock();
|
||||||
|
if (socket)
|
||||||
|
return socket->processInputEnabled();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
#if !MOBILEAPP
|
#if !MOBILEAPP
|
||||||
|
@ -1039,15 +1048,6 @@ protected:
|
||||||
socket->enableProcessInput(enable);
|
socket->enableProcessInput(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool processInputEnabled() const override
|
|
||||||
{
|
|
||||||
std::shared_ptr<StreamSocket> socket = _socket.lock();
|
|
||||||
if (socket)
|
|
||||||
return socket->processInputEnabled();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void gotPing(WSOpCode /* code */, int /* pingTimeUs */)
|
virtual void gotPing(WSOpCode /* code */, int /* pingTimeUs */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue