summaryrefslogtreecommitdiffstats
path: root/lib/libtdekrb/src/tdekrbclientsocket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libtdekrb/src/tdekrbclientsocket.cpp')
-rw-r--r--lib/libtdekrb/src/tdekrbclientsocket.cpp47
1 files changed, 46 insertions, 1 deletions
diff --git a/lib/libtdekrb/src/tdekrbclientsocket.cpp b/lib/libtdekrb/src/tdekrbclientsocket.cpp
index 02bee4d..9e9a27a 100644
--- a/lib/libtdekrb/src/tdekrbclientsocket.cpp
+++ b/lib/libtdekrb/src/tdekrbclientsocket.cpp
@@ -204,7 +204,7 @@ bool TDEKerberosClientSocket::atEnd() const {
bool ret;
if (kerberosStatus() == KerberosInUse) {
- ret = TQSocket::atEnd();
+ ret = ((m_bufferLength < 1) && TQSocket::atEnd());
}
else {
ret = TQSocket::atEnd();
@@ -710,6 +710,51 @@ bool TDEKerberosClientSocket::canReadData() {
return (TQSocket::canReadLine() || (m_bufferLength > 0));
}
+void TDEKerberosClientSocket::clearIncomingData() {
+ char data[64];
+ processPendingData();
+ while (canReadData()) {
+ readBlock(data, 64);
+ }
+}
+
+int TDEKerberosClientSocket::writeEndOfFrame() {
+ char data[1];
+ data[0] = 255;
+ return writeBlock(data, 1);
+}
+
+bool TDEKerberosClientSocket::canReadFrame() {
+ processPendingData();
+ if (m_buffer->buffer().contains(255) > 0) {
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+
+void TDEKerberosClientSocket::clearFrameTail() {
+ int i;
+ int eofLoc;
+ if (m_bufferLength > 0) {
+ eofLoc = m_buffer->buffer().find(255, 0) + 1;
+ if ((eofLoc > 0) && (eofLoc <= m_bufferLength)) {
+ // Remove the remaining frame bytes (including the End of Frame marker) from the buffer
+ m_bufferLength = m_bufferLength-eofLoc;
+ TQByteArray ba = m_buffer->buffer();
+ for (i=0; i<m_bufferLength;i++) {
+ ba[i] = ba[i+eofLoc];
+ }
+ if (m_bufferLength < 1) {
+ // Clear the buffer from memory
+ m_buffer->close();
+ m_buffer->open(IO_ReadWrite|IO_Truncate);
+ }
+ }
+ }
+}
+
void TDEKerberosClientSocket::setStatusMessage(TQString message) {
if (message != m_prevStatusMessage) {
emit(statusMessageUpdated(message));