diff options
Diffstat (limited to 'pacman-c++')
| -rw-r--r-- | pacman-c++/mainwidget.cpp | 5 | ||||
| -rw-r--r-- | pacman-c++/server.cpp | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp index 1631d3f..420ea8f 100644 --- a/pacman-c++/mainwidget.cpp +++ b/pacman-c++/mainwidget.cpp | |||
| @@ -175,7 +175,6 @@ void MainWidget::tick() | |||
| 175 | } | 175 | } |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | |||
| 179 | void MainWidget::keyPressEvent(QKeyEvent* event) | 178 | void MainWidget::keyPressEvent(QKeyEvent* event) |
| 180 | { | 179 | { |
| 181 | if (!m_running) | 180 | if (!m_running) |
| @@ -195,6 +194,10 @@ void MainWidget::keyPressEvent(QKeyEvent* event) | |||
| 195 | std::string dataStr = packet.SerializeAsString(); | 194 | std::string dataStr = packet.SerializeAsString(); |
| 196 | unsigned int bytesWritten = m_socket->write(dataStr.c_str(), dataStr.length()); | 195 | unsigned int bytesWritten = m_socket->write(dataStr.c_str(), dataStr.length()); |
| 197 | m_socket->flush(); | 196 | m_socket->flush(); |
| 197 | if (bytesWritten != dataStr.length()) { | ||
| 198 | qDebug() << "written: " << bytesWritten; | ||
| 199 | qDebug() << "strl: " << dataStr.length(); | ||
| 200 | } | ||
| 198 | Q_ASSERT(bytesWritten == dataStr.length()); | 201 | Q_ASSERT(bytesWritten == dataStr.length()); |
| 199 | 202 | ||
| 200 | qDebug() << "send key: " << m_currentKey; | 203 | qDebug() << "send key: " << m_currentKey; |
diff --git a/pacman-c++/server.cpp b/pacman-c++/server.cpp index 2dc2a13..bbe4ad6 100644 --- a/pacman-c++/server.cpp +++ b/pacman-c++/server.cpp | |||
| @@ -95,6 +95,10 @@ void Server::sendUpdate(QSharedPointer< ProtoBuf::MapUpdate > packet) | |||
| 95 | foreach(QTcpSocket *socket, m_clientConnections) { | 95 | foreach(QTcpSocket *socket, m_clientConnections) { |
| 96 | //qDebug() << "sending str len: " << dataStr.length(); | 96 | //qDebug() << "sending str len: " << dataStr.length(); |
| 97 | int bytesWritten = socket->write(data, dataStr.length()); | 97 | int bytesWritten = socket->write(data, dataStr.length()); |
| 98 | if (bytesWritten != dataStr.length()) { | ||
| 99 | qDebug() << "written: " << bytesWritten; | ||
| 100 | qDebug() << "strl: " << dataStr.length(); | ||
| 101 | } | ||
| 98 | Q_ASSERT(bytesWritten == dataStr.length()); | 102 | Q_ASSERT(bytesWritten == dataStr.length()); |
| 99 | } | 103 | } |
| 100 | foreach(QTcpSocket *socket, m_clientConnections) { | 104 | foreach(QTcpSocket *socket, m_clientConnections) { |
