OK...I'm running with this patch right now based on the behavior I was
seeing.  Been going for an hour with no timeouts.
Once HRD Logbook is running two things happen.
#1 HRD replies slow down a bit.  So I see this in the new log output showing
about 2 second times (verified by network capture)
Mon Sep 8 13:45:29 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get radio" ): -> "TT-OMNI VII (Radio)"
Mon Sep 8 13:45:31 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 52

#2 The time interval from send to ready-to-read increases dramatically.  I
regularly see 4 second and greater delays.  Sometimes 9 second delays.  Once
saw a 14-second delay.
And here's where I started up HRD Logbook.  During its startup things slowed
down quite noticeably (busy TCP socket?).
So right before HRD Logbook starts up all is well...~1-second response
times.
Then at 14:12:20 thinks slow down.
That command takes 4 seconds, followed by the next command at 10 seconds,
followed by the next command at 19 seconds, 6 seconds, and 26 seconds!!!
Maybe this timeout should be 60 seconds???
So first command takes 5 seconds, 2nd one takes, 9 seconds, 3rd one takes 14
seconds.

Mon Sep 8 14:12:15 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get frequencies" ): -> "7076000-7043800"
Mon Sep 8 14:12:16 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 60
Mon Sep 8 14:12:16 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 60
Mon Sep 8 14:12:16 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get radio" ): -> "TT-OMNI VII (Radio)"
Mon Sep 8 14:12:17 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 52
Mon Sep 8 14:12:17 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 52
Mon Sep 8 14:12:17 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get frequencies" ): -> "7076000-7043800"
Mon Sep 8 14:12:18 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 60
Mon Sep 8 14:12:18 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 60
Mon Sep 8 14:12:18 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get radio" ): -> "TT-OMNI VII (Radio)"
Mon Sep 8 14:12:20 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 52
Mon Sep 8 14:12:20 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 52
Mon Sep 8 14:12:20 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get frequencies" ): -> "7076000-7043800"
Mon Sep 8 14:12:24 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 60
Mon Sep 8 14:12:24 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 60
Mon Sep 8 14:12:24 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get radio" ): -> "TT-OMNI VII (Radio)"
Mon Sep 8 14:12:30 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 52
Mon Sep 8 14:12:30 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 52
Mon Sep 8 14:12:30 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get frequencies" ): -> "7076000-7043800"
Mon Sep 8 14:12:34 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 60
Mon Sep 8 14:12:34 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 60
Mon Sep 8 14:12:34 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get radio" ): -> "TT-OMNI VII (Radio)"
Mon Sep 8 14:12:44 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 52
Mon Sep 8 14:12:44 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 52
Mon Sep 8 14:12:44 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get frequencies" ): -> "7076000-7043800"
Mon Sep 8 14:13:03 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 60
Mon Sep 8 14:13:03 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 60
Mon Sep 8 14:13:03 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get radio" ): -> "TT-OMNI VII (Radio)"
Mon Sep 8 14:13:09 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 52
Mon Sep 8 14:13:09 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 52
Mon Sep 8 14:13:09 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:824)Debug:
HRDTransceiver::send_command( "get frequencies" ): -> "7076000-7043800"
Mon Sep 8 14:13:35 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:762)Debug:
HRDTransceiver::send_command bytesAvailable= 60
Mon Sep 8 14:13:35 2014
GMT(C:\JTSDK-QT\src\wsjtx\HRDTransceiver.cpp:794)Debug:
HRDTransceiver::send_command: reply byte count: 60


That's why I set the timeout to 30 seconds (~2X the longest reply I've seen
so far).
I've been running this for 30 minutes right now with HRD Logbook with no
timeouts or retries.
I'm going to run this for at least an hour and then startup DM780 and see
what happens since that's another port 7809 connection.

Probably need an error check if the socket goes away while waiting for
bytesAvailable.
And I had size instances of "bytesAvailable= 0" so the 30 second timeout was
getting hit but the retry worked.

Index: HRDTransceiver.cpp
===================================================================
--- HRDTransceiver.cpp  (revision 4270)
+++ HRDTransceiver.cpp  (working copy)
@@ -11,7 +11,7 @@
 namespace
 {
   char const * const HRD_transceiver_name = "Ham Radio Deluxe";
-  int socket_wait_time {5000};
+  int socket_wait_time {30000};
 }

 void HRDTransceiver::register_transceivers
(TransceiverFactory::Transceivers * registry, int id)
@@ -693,7 +693,7 @@
           .arg (hrd_->errorString ())
           };
     }
-
+  QThread::msleep(50);
   int bytes_to_send;
   int total_bytes_sent {0};
   if (v4 == protocol_)
@@ -702,6 +702,12 @@
       bytes_to_send = message.size ();
       while (total_bytes_sent < bytes_to_send)
         {
+      if (!no_debug)
+        {
+#if WSJT_TRACE_CAT
+          qDebug () << "HRDTransceiver::send_command:" << message;
+#endif
+        }
           auto bytes_sent = hrd_->write (message.constData () +
total_bytes_sent, bytes_to_send - total_bytes_sent);
           if (bytes_sent < 0 || !hrd_->waitForBytesWritten
(socket_wait_time))
             {
@@ -718,12 +724,6 @@
           total_bytes_sent += bytes_sent;
         }

-      if (!no_debug)
-        {
-#if WSJT_TRACE_CAT
-          qDebug () << "HRDTransceiver::send_command:" << message;
-#endif
-        }
     }
   else
     {
@@ -733,6 +733,10 @@
       while (total_bytes_sent < bytes_to_send)
         {
           auto bytes_sent = hrd_->write (reinterpret_cast<char *>
(message.data ()) + total_bytes_sent, bytes_to_send - total_bytes_sent);
+          while(hrd->bytesToWrite() > 0)
+            {
+              QThread::msleep(50);
+            }
           if (bytes_sent < 0 || !hrd_->waitForBytesWritten
(socket_wait_time))
             {
 #if WSJT_TRACE_CAT
@@ -755,7 +759,12 @@
   bool replied {false};
   while (!replied && --retries)
     {
-      replied = hrd_->waitForReadyRead (socket_wait_time);
+      hrd_->waitForReadyRead (socket_wait_time);
+      auto mybytes = hrd_->bytesAvailable();
+      replied = mybytes > 0;
+#if WSJT_TRACE_CAT
+      qDebug () << "HRDTransceiver::send_command bytesAvailable=" <<
mybytes;
+#endif
       if (!replied && hrd_->error () != hrd_->SocketTimeoutError)
         {
 #if WSJT_TRACE_CAT
@@ -781,7 +790,7 @@
           .arg (cmd)
           };
     }
-
+
   QByteArray buffer (hrd_->readAll ());
   if (!no_debug)
     {


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
wsjt-devel mailing list
wsjt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wsjt-devel

Reply via email to