pull/224/head
Michael Black 2020-04-22 12:38:10 -05:00
commit 51a0e1b016
1 zmienionych plików z 43 dodań i 44 usunięć

Wyświetl plik

@ -1048,17 +1048,16 @@ void *handle_socket(void *arg)
rig_debug(RIG_DEBUG_ERR, "%s: rig_open retcode=%d\n", __func__, retcode); rig_debug(RIG_DEBUG_ERR, "%s: rig_open retcode=%d\n", __func__, retcode);
} }
} }
}
while (retcode == 0 || retcode == 2 || retcode == -RIG_ENAVAIL); while (retcode == 0 || retcode == 2 || retcode == -RIG_ENAVAIL);
#ifdef HAVE_PTHREAD #ifdef HAVE_PTHREAD
#if 0 #if 0
sync_callback(1); sync_callback(1);
/* Release rig if there are no clients */ /* Release rig if there are no clients */
if (!--client_count) if (!--client_count)
{ {
rig_close(my_rig); rig_close(my_rig);
if (verbose > RIG_DEBUG_ERR) if (verbose > RIG_DEBUG_ERR)
@ -1067,23 +1066,23 @@ if (!--client_count)
my_rig->caps->rig_model, my_rig->caps->rig_model,
my_rig->caps->model_name); my_rig->caps->model_name);
} }
} }
sync_callback(0); sync_callback(0);
#endif #endif
#else #else
rig_close(my_rig); rig_close(my_rig);
if (verbose > RIG_DEBUG_ERR) if (verbose > RIG_DEBUG_ERR)
{ {
printf("Closed rig model %d, '%s - will reopen for new clients'\n", printf("Closed rig model %d, '%s - will reopen for new clients'\n",
my_rig->caps->rig_model, my_rig->caps->rig_model,
my_rig->caps->model_name); my_rig->caps->model_name);
} }
#endif #endif
if ((retcode = getnameinfo((struct sockaddr const *)&handle_data_arg->cli_addr, if ((retcode = getnameinfo((struct sockaddr const *)&handle_data_arg->cli_addr,
handle_data_arg->clilen, handle_data_arg->clilen,
host, host,
sizeof(host), sizeof(host),
@ -1091,12 +1090,12 @@ if ((retcode = getnameinfo((struct sockaddr const *)&handle_data_arg->cli_addr,
sizeof(serv), sizeof(serv),
NI_NOFQDN)) NI_NOFQDN))
< 0) < 0)
{ {
rig_debug(RIG_DEBUG_WARN, "Peer lookup error: %s", gai_strerror(retcode)); rig_debug(RIG_DEBUG_WARN, "Peer lookup error: %s", gai_strerror(retcode));
} }
rig_debug(RIG_DEBUG_VERBOSE, rig_debug(RIG_DEBUG_VERBOSE,
"Connection closed from %s:%s\n", "Connection closed from %s:%s\n",
host, host,
serv); serv);
@ -1105,28 +1104,28 @@ handle_exit:
// for MINGW we close the handle before fclose // for MINGW we close the handle before fclose
#ifdef __MINGW32__ #ifdef __MINGW32__
retcode = closesocket(handle_data_arg->sock); retcode = closesocket(handle_data_arg->sock);
if (retcode != 0) { rig_debug(RIG_DEBUG_ERR, "%s: fclose(fsockin) %s\n", __func__, strerror(retcode)); } if (retcode != 0) { rig_debug(RIG_DEBUG_ERR, "%s: fclose(fsockin) %s\n", __func__, strerror(retcode)); }
#endif #endif
fclose(fsockin); fclose(fsockin);
fclose(fsockout); fclose(fsockout);
// for everybody else we close the handle after fclose // for everybody else we close the handle after fclose
#ifndef __MINGW32__ #ifndef __MINGW32__
retcode = close(handle_data_arg->sock); retcode = close(handle_data_arg->sock);
if (retcode != 0 && errno != EBADF) { rig_debug(RIG_DEBUG_ERR, "%s: close(handle_data_arg->sock) %s\n", __func__, strerror(errno)); } if (retcode != 0 && errno != EBADF) { rig_debug(RIG_DEBUG_ERR, "%s: close(handle_data_arg->sock) %s\n", __func__, strerror(errno)); }
#endif #endif
free(arg); free(arg);
#ifdef HAVE_PTHREAD #ifdef HAVE_PTHREAD
pthread_exit(NULL); pthread_exit(NULL);
#endif #endif
return NULL; return NULL;
} }