kopia lustrzana https://github.com/Hamlib/Hamlib
Improve rigctld printout when TCP session is aborted
rodzic
f57b7cba71
commit
8478367223
|
@ -1025,6 +1025,7 @@ void *multicast_receiver(void *arg)
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
// Windows cannot bind to multicast group addresses for some unknown reason
|
// Windows cannot bind to multicast group addresses for some unknown reason
|
||||||
dest_addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
dest_addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s(%d): INADDR_ANY=%x,%x\n", htonl(INADDR_ANY), INADDR_ANY);
|
||||||
#else
|
#else
|
||||||
dest_addr.sin_addr.s_addr = inet_addr(args->multicast_addr);
|
dest_addr.sin_addr.s_addr = inet_addr(args->multicast_addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -720,9 +720,18 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
|
||||||
{
|
{
|
||||||
if ((retcode = scanfc(fin, "%c", &cmd)) < 1)
|
if ((retcode = scanfc(fin, "%c", &cmd)) < 1)
|
||||||
{
|
{
|
||||||
|
if (last_cmd==0)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_WARN, "%s: nothing to scan#1? retcode=%d, last_cmd=[empty]\n",
|
||||||
|
__func__,
|
||||||
|
retcode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
rig_debug(RIG_DEBUG_WARN, "%s: nothing to scan#1? retcode=%d, last_cmd=%c\n",
|
rig_debug(RIG_DEBUG_WARN, "%s: nothing to scan#1? retcode=%d, last_cmd=%c\n",
|
||||||
__func__,
|
__func__,
|
||||||
retcode, last_cmd);
|
retcode, last_cmd);
|
||||||
|
}
|
||||||
return (RIGCTL_PARSE_ERROR);
|
return (RIGCTL_PARSE_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -867,6 +867,26 @@ int main(int argc, char *argv[])
|
||||||
freeaddrinfo(saved_result); /* No longer needed */
|
freeaddrinfo(saved_result); /* No longer needed */
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
int optval = 1;
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
if (setsockopt(sock_listen, SOL_SOCKET, SO_REUSEADDR, (PCHAR)&optval, sizeof(optval)) < 0)
|
||||||
|
#else
|
||||||
|
if (setsockopt(sock_listen, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: error enabling UDP address reuse: %s\n", __func__,
|
||||||
|
strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Windows does not have SO_REUSEPORT. However, SO_REUSEADDR works in a similar way.
|
||||||
|
#if defined(SO_REUSEPORT)
|
||||||
|
if (setsockopt(sock_listen, SOL_SOCKET, SO_REUSEPORT, &optval, sizeof(optval)) < 0)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: error enabling UDP port reuse: %s\n", __func__,
|
||||||
|
strerror(errno));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (setsockopt(sock_listen,
|
if (setsockopt(sock_listen,
|
||||||
|
|
Ładowanie…
Reference in New Issue