* This is the function run by the threads */
| 1136 | * This is the function run by the threads |
| 1137 | */ |
| 1138 | void *handle_socket(void *arg) |
| 1139 | { |
| 1140 | struct handle_data *handle_data_arg = (struct handle_data *)arg; |
| 1141 | FILE *fsockin = NULL; |
| 1142 | FILE *fsockout = NULL; |
| 1143 | int retcode = RIG_OK; |
| 1144 | char host[NI_MAXHOST]; |
| 1145 | char serv[NI_MAXSERV]; |
| 1146 | char send_cmd_term = '\r'; /* send_cmd termination char */ |
| 1147 | int ext_resp = 0; |
| 1148 | char my_resp_sep = resp_sep; // Separator for this connection, initial default |
| 1149 | rig_powerstat = RIG_POWER_ON; // defaults to power on |
| 1150 | struct timespec powerstat_check_time; |
| 1151 | |
| 1152 | fsockin = get_fsockin(handle_data_arg); |
| 1153 | |
| 1154 | if (!fsockin) |
| 1155 | { |
| 1156 | rig_debug(RIG_DEBUG_ERR, "%s: fdopen(0x%d) in: %s\n", __func__, |
| 1157 | handle_data_arg->sock, |
| 1158 | strerror(errno)); |
| 1159 | goto handle_exit; |
| 1160 | } |
| 1161 | |
| 1162 | fsockout = get_fsockout(handle_data_arg); |
| 1163 | |
| 1164 | if (!fsockout) |
| 1165 | { |
| 1166 | rig_debug(RIG_DEBUG_ERR, "%s: fdopen out: %s\n", __func__, strerror(errno)); |
| 1167 | fclose(fsockin); |
| 1168 | fsockin = NULL; |
| 1169 | |
| 1170 | goto handle_exit; |
| 1171 | } |
| 1172 | |
| 1173 | retcode = pthread_setspecific(thread_data_key, arg); |
| 1174 | if (0 != retcode) |
| 1175 | { |
| 1176 | rig_debug(RIG_DEBUG_ERR, "%s: Could not set thread daya\n", __func__); |
| 1177 | // What do we do here? |
| 1178 | } |
| 1179 | |
| 1180 | mutex_rigctld(1); |
| 1181 | |
| 1182 | ++client_count; |
| 1183 | #if 0 |
| 1184 | |
| 1185 | if (!client_count++) |
| 1186 | { |
| 1187 | retcode = rig_open(my_rig); |
| 1188 | |
| 1189 | if (RIG_OK == retcode && verbose > RIG_DEBUG_ERR) |
| 1190 | { |
| 1191 | printf("Opened rig model %d, '%s'\n", |
| 1192 | my_rig->caps->rig_model, |
| 1193 | my_rig->caps->model_name); |
| 1194 | } |
| 1195 | } |
nothing calls this directly
no test coverage detected