* This is the function run by the threads */
| 1038 | * This is the function run by the threads |
| 1039 | */ |
| 1040 | void *handle_socket(void *arg) |
| 1041 | { |
| 1042 | struct handle_data *handle_data_arg = (struct handle_data *)arg; |
| 1043 | FILE *fsockin = NULL; |
| 1044 | FILE *fsockout = NULL; |
| 1045 | int retcode = RIG_OK; |
| 1046 | char host[NI_MAXHOST]; |
| 1047 | char serv[NI_MAXSERV]; |
| 1048 | rig_powerstat = RIG_POWER_ON; // defaults to power on |
| 1049 | |
| 1050 | fsockin = get_fsockin(handle_data_arg); |
| 1051 | |
| 1052 | if (!fsockin) |
| 1053 | { |
| 1054 | rig_debug(RIG_DEBUG_ERR, "%s: fdopen(0x%d) in: %s\n", __func__, |
| 1055 | handle_data_arg->sock, |
| 1056 | strerror(errno)); |
| 1057 | goto handle_exit; |
| 1058 | } |
| 1059 | |
| 1060 | fsockout = get_fsockout(handle_data_arg); |
| 1061 | |
| 1062 | if (!fsockout) |
| 1063 | { |
| 1064 | rig_debug(RIG_DEBUG_ERR, "%s: fdopen out: %s\n", __func__, strerror(errno)); |
| 1065 | fclose(fsockin); |
| 1066 | fsockin = NULL; |
| 1067 | |
| 1068 | goto handle_exit; |
| 1069 | } |
| 1070 | |
| 1071 | retcode = pthread_setspecific(thread_data_key, arg); |
| 1072 | if (retcode != 0) |
| 1073 | { |
| 1074 | rig_debug(RIG_DEBUG_ERR, "%s: Could not set thread data\n", __func__); |
| 1075 | // What should we do here??? |
| 1076 | } |
| 1077 | |
| 1078 | mutex_rigctld(1); |
| 1079 | |
| 1080 | ++client_count; |
| 1081 | #if 0 |
| 1082 | |
| 1083 | if (!client_count++) |
| 1084 | { |
| 1085 | retcode = rig_open(my_rig); |
| 1086 | |
| 1087 | if (RIG_OK == retcode && verbose > RIG_DEBUG_ERR) |
| 1088 | { |
| 1089 | printf("Opened rig model %d, '%s'\n", |
| 1090 | my_rig->caps->rig_model, |
| 1091 | my_rig->caps->model_name); |
| 1092 | } |
| 1093 | } |
| 1094 | |
| 1095 | #endif |
| 1096 | |
| 1097 | mutex_rigctld(0); |
nothing calls this directly
no test coverage detected