rigctld.c add retry of rig_open with an IO error

https://github.com/Hamlib/Hamlib/issues/560
pull/608/head
Michael Black W9MDB 2021-03-07 09:03:37 -06:00
rodzic b2a0b15a67
commit 94e51bfa24
1 zmienionych plików z 17 dodań i 4 usunięć

Wyświetl plik

@ -1087,13 +1087,26 @@ void *handle_socket(void *arg)
#endif
// if socket error or rigctld gets RIG_EIO we'll try to reopen
if (ferror(fsockin))
// if we get a hard error we try to reopen the rig again
// this should cover short dropouts that can occur
if (retcode == -RIG_EIO || retcode == 2)
{
rig_debug(RIG_DEBUG_ERR, "%s: sockin err=%s\n", __func__, strerror(errno));
return(NULL);
int retry = 3;
rig_debug(RIG_DEBUG_ERR, "%s: i/o error\n", __func__)
do
{
retcode = rig_close(my_rig);
hl_usleep(1000 * 1000);
rig_debug(RIG_DEBUG_ERR, "%s: rig_close retcode=%d\n", __func__, retcode);
retcode = rig_open(my_rig);
rig_debug(RIG_DEBUG_ERR, "%s: rig_open retcode=%d\n", __func__, retcode);
}
while (retry-- > 0 && retcode != RIG_OK);
}
#if 0
if (ferror(fsockin) || ferror(fsockout) || retcode == 2)