[prev in list] [next in list] [prev in thread] [next in thread] 

List:       atlantik-devel
Subject:    [atlantik-cvs] CVS: kdegames/atlantik/libatlantikclient atlantik_network.cpp,1.46,1.47
From:       kde () office ! kde ! org
Date:       2002-07-14 10:53:57
[Download RAW message or body]

Update of /home/kde/kdegames/atlantik/libatlantikclient
In directory office:/tmp/cvs-serv15551/libatlantikclient

Modified Files:
	atlantik_network.cpp 
Log Message:
more gui updates during network traffic

Index: atlantik_network.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikclient/atlantik_network.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- atlantik_network.cpp	2002/07/11 09:04:10	1.46
+++ atlantik_network.cpp	2002/07/14 10:53:55	1.47
@@ -16,6 +16,8 @@
 
 #include <iostream>
 
+#include <qtimer.h>
+
 #include <kdebug.h>
 #include <klocale.h>
 #include <kmessagebox.h>
@@ -206,18 +208,23 @@
 
 void AtlantikNetwork::slotRead()
 {
-	char *tmp = new char[1024 * 32];
-	while(canReadLine())
+	if (canReadLine())
 	{
+		char *tmp = new char[1024 * 32];
 		readLine(tmp, 1024 * 32);
 		processMsg(tmp);
-	}
-	delete[] tmp;
+		delete[] tmp;
 
-	// Maximum message size. Messages won't get bigger than 32k anyway, so
-	// if we didn't receive a newline by now, we probably won't anyway.
-	if (bytesAvailable() > (1024 * 32))
-		flush();
+		// There might be more data
+		QTimer::singleShot(0, this, SLOT(slotRead()));
+	}
+	else
+	{
+		// Maximum message size. Messages won't get bigger than 32k anyway, so
+		// if we didn't receive a newline by now, we probably won't anyway.
+		if (bytesAvailable() > (1024 * 32))
+			flush();
+	}
 }
 
 void AtlantikNetwork::processMsg(QString str)

_______________________________________________
atlantik-cvs mailing list
atlantik-cvs@mail.kde.org
http://mail.kde.org/mailman/listinfo/atlantik-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic