mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-13 01:07:24 -05:00
M17 - Persistent TCP Retry When M17 Decoding Enabled;
This commit is contained in:
@@ -2637,6 +2637,7 @@ main (int argc, char **argv)
|
||||
if (curr != NULL) opts.tcp_portno = atoi (curr);
|
||||
|
||||
TCPEND:
|
||||
if (exitflag == 1) cleanupAndExit(&opts, &state); //needed to break the loop on ctrl+c
|
||||
fprintf (stderr, "%s:", opts.tcp_hostname);
|
||||
fprintf (stderr, "%d \n", opts.tcp_portno);
|
||||
opts.tcp_sockfd = Connect(opts.tcp_hostname, opts.tcp_portno);
|
||||
@@ -2653,6 +2654,11 @@ main (int argc, char **argv)
|
||||
sprintf (opts.audio_in_dev, "%s", "/dev/dsp");
|
||||
opts.audio_in_type = 5;
|
||||
#else
|
||||
if (opts.frame_m17 == 1)
|
||||
{
|
||||
sleep(1);
|
||||
goto TCPEND; //try again if using M17 encoder / decoder over TCP
|
||||
}
|
||||
sprintf (opts.audio_in_dev, "%s", "pulse");
|
||||
fprintf (stderr, "TCP Connection Failure - Using %s Audio Input.\n", opts.audio_in_dev);
|
||||
opts.audio_in_type = 0;
|
||||
|
||||
@@ -222,6 +222,8 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
|
||||
#else
|
||||
result = sf_read_short(opts->tcp_file_in, &sample, 1);
|
||||
if(result == 0) {
|
||||
TCP_RETRY:
|
||||
if (exitflag == 1) cleanupAndExit(opts, state); //needed to break the loop on ctrl+c
|
||||
fprintf (stderr, "\nConnection to TCP Server Interrupted. Trying again in 3 seconds.\n");
|
||||
sample = 0;
|
||||
sf_close(opts->tcp_file_in); //close current connection on this end
|
||||
@@ -246,7 +248,11 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
|
||||
}
|
||||
else fprintf (stderr, "TCP Socket Reconnected Successfully.\n");
|
||||
}
|
||||
else fprintf (stderr, "TCP Socket Connection Error.\n");
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "TCP Socket Connection Error.\n");
|
||||
if (opts->frame_m17 == 1) goto TCP_RETRY; //if using m17 encoder/decoder, just keep looping to keep alive
|
||||
}
|
||||
|
||||
//now retry reading sample
|
||||
result = sf_read_short(opts->tcp_file_in, &sample, 1);
|
||||
|
||||
Reference in New Issue
Block a user