Small fix

Sun, 27 Jul 2014 21:04:57 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 27 Jul 2014 21:04:57 +0200
changeset 141
f19a52a25ff5
parent 140
1b001de37945
child 142
4f21ffc16cd4

Small fix

www-thermferm/profiles.php file | annotate | diff | comparison | revisions
--- a/www-thermferm/profiles.php	Sun Jul 27 17:06:08 2014 +0200
+++ b/www-thermferm/profiles.php	Sun Jul 27 21:04:57 2014 +0200
@@ -314,12 +314,21 @@
 		if ($sock != false) {
 		    socket_write($sock, 'PROFILE PUTS '.$_POST['UUID'], 4096);
 		    for ($i = 1; $i <= 8; $i++) {
-			if ($_POST['steptime'.$i] > 0)
+			/*
+			 * Use small delays so the remote really sees single lines.
+			 * This is a real bug between client/server programming,
+			 * the PHP side is line oriented, the server is reading blocks.
+			 * So we just send the data slowly and the server just sees lines.
+			 */
+			if ($_POST['steptime'.$i] > 0) {
+			    usleep(20000);
 			    socket_write($sock, $_POST['steptime'.$i].','.$_POST['resttime'.$i].','.$_POST['target'.$i], 4096);
+			}
 			unset($_POST['steptime'.$i]);
 			unset($_POST['resttime'.$i]);
 			unset($_POST['target'.$i]);
 		    }
+		    usleep(20000);
 		    socket_write($sock, '.', 4096);
 		    /* Absorb response */
 		    while (1) {

mercurial