Revision: 75851
http://sourceforge.net/p/brlcad/code/75851
Author: starseeker
Date: 2020-05-20 20:24:26 +0000 (Wed, 20 May 2020)
Log Message:
-----------
Use BU_SEC2USEC to make timings more intuitive, wait up to 10 sec.
Modified Paths:
--------------
brlcad/trunk/regress/pkg/regress_pkg_client.cpp
brlcad/trunk/regress/pkg/regress_pkg_server.cpp
Modified: brlcad/trunk/regress/pkg/regress_pkg_client.cpp
===================================================================
--- brlcad/trunk/regress/pkg/regress_pkg_client.cpp 2020-05-20 20:02:23 UTC
(rev 75850)
+++ brlcad/trunk/regress/pkg/regress_pkg_client.cpp 2020-05-20 20:24:26 UTC
(rev 75851)
@@ -97,8 +97,10 @@
connection = pkg_open(server, s_port, "tcp", NULL, NULL, NULL, NULL);
if (connection == PKC_ERROR) {
- while ((bu_gettime() - timer) / 1000000.0 < 1.0) {
- bu_snooze(10000);
+ // Wait for up to 1 second
+ while ((bu_gettime() - timer) < BU_SEC2USEC(10.0)) {
+ // To avoid constant polling, sleep for a short interval
+ bu_snooze(BU_SEC2USEC(0.1));
connection = pkg_open(server, s_port, "tcp", NULL, NULL, NULL,
NULL);
}
Modified: brlcad/trunk/regress/pkg/regress_pkg_server.cpp
===================================================================
--- brlcad/trunk/regress/pkg/regress_pkg_server.cpp 2020-05-20 20:02:23 UTC
(rev 75850)
+++ brlcad/trunk/regress/pkg/regress_pkg_server.cpp 2020-05-20 20:24:26 UTC
(rev 75851)
@@ -116,12 +116,14 @@
do {
client = pkg_getclient(netfd, callbacks, NULL, 1);
if (client == PKC_NULL) {
- if ((bu_gettime() - timer) / 1000000.0 > 1.0) {
- bu_log("Connection inactive for > 1 second, quitting.\n");
+ // If we've been trying for more than 10 seconds, something
+ // went wrong with the test.
+ if ((bu_gettime() - timer) > BU_SEC2USEC(10.0)) {
+ bu_log("Connection inactive for >10 seconds, quitting.\n");
bu_exit(1, "Timeout - inactive");
}
bu_log("Connection seems to be busy, waiting...\n");
- bu_snooze(100000);
+ bu_snooze(BU_SEC2USEC(0.1));
continue;
} else if (client == PKC_ERROR) {
pkg_close(client);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits