| 104 | } |
| 105 | |
| 106 | void CConnection::slotReadyRead() |
| 107 | { |
| 108 | qDebug(TigerVNC) << "CConnection::slotReadyRead()"; |
| 109 | if (state() == RFBSTATE_CLOSING) return; |
| 110 | try { |
| 111 | inProcessMessages = true; |
| 112 | |
| 113 | // Get the underlying transport to build large packets if we send |
| 114 | // multiple small responses. |
| 115 | getOutStream()->cork(true); |
| 116 | |
| 117 | while (true) { |
| 118 | if (pendingSyncFence) |
| 119 | syncFence = true; |
| 120 | |
| 121 | if (!processMsg()) |
| 122 | break; |
| 123 | |
| 124 | if (syncFence) { |
| 125 | writer()->writeFence(fenceFlags, fenceDataLen, fenceData); |
| 126 | syncFence = false; |
| 127 | pendingSyncFence = false; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | // Flush out everything in case we go idle after this. |
| 132 | getOutStream()->cork(false); |
| 133 | |
| 134 | inProcessMessages = false; |
| 135 | |
| 136 | // If there were anything requiring an update, try to send it here. |
| 137 | // We wait until now with this to aggregate responses and to give |
| 138 | // higher priority to user actions such as keyboard and pointer events. |
| 139 | if(writer()) |
| 140 | { |
| 141 | QImage img = CDesktop::Instance()->GetDesktop(); |
| 142 | slotDesktopUpdate(img, img.rect()); |
| 143 | } |
| 144 | } catch (rdr::Exception e) { |
| 145 | qCritical(TigerVNC) << "Exception:" << e.str(); |
| 146 | emit sigError(-1, QString("processMsg exception:") + e.str()); |
| 147 | } catch (std::exception e) { |
| 148 | qCritical(TigerVNC) << "std Exception:" << e.what(); |
| 149 | emit sigError(-1, QString("std Exception:") + e.what()); |
| 150 | } catch (...) { |
| 151 | qCritical(TigerVNC) << "exception"; |
| 152 | emit sigError(-1, QString("Exception:")); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | void CConnection::slotDisconnected() |
| 157 | { |
nothing calls this directly
no test coverage detected