Changeset 2944
- Timestamp:
- 08/19/10 23:17:58 (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/globals.h
r2942 r2944 1055 1055 extern int use_ac_log; 1056 1056 #endif 1057 extern pthread_mutex_t gethostbyname_lock; //gethostbyname ist NOT threadsafe! So we need a mutex-lock!1057 extern pthread_mutex_t gethostbyname_lock; 1058 1058 1059 1059 // oscam -
trunk/oscam-http.c
r2943 r2944 2192 2192 ok = 1; 2193 2193 } else { 2194 pthread_mutex_lock(&gethostbyname_lock); 2194 2195 struct hostent *rht; 2195 2196 struct sockaddr_in udp_sa; 2197 2196 2198 rht = gethostbyname((const char *) cfg->http_dyndns); 2197 2199 if (rht) { … … 2201 2203 ok = 1; 2202 2204 } 2205 pthread_mutex_unlock(&gethostbyname_lock); 2203 2206 } 2204 2207 } -
trunk/oscam-reader.c
r2886 r2944 150 150 hints.ai_protocol = IPPROTO_TCP; 151 151 152 pthread_mutex_lock(&gethostbyname_lock); 152 153 int err = getaddrinfo(reader[ridx].device, NULL, &hints, &res); 153 154 if (err != 0 || !res || !res->ai_addr) { … … 165 166 } 166 167 if (res) freeaddrinfo(res); 168 pthread_mutex_unlock(&gethostbyname_lock); 167 169 return (client[cs_idx].udp_sa.sin_addr.s_addr) ? 1 : 0; 168 170 } -
trunk/oscam.c
r2942 r2944 27 27 char cs_confdir[128]=CS_CONFDIR; 28 28 uchar mbuf[1024]; // global buffer 29 pthread_mutex_t gethostbyname_lock; 29 30 ECM_REQUEST *ecmtask; 30 31 #ifdef CS_ANTICASC … … 925 926 strcpy(client[0].usr, "root"); 926 927 928 pthread_mutex_init(&gethostbyname_lock, NULL); 927 929 init_stat(); 928 930 … … 1062 1064 if (account->dyndns[0]) 1063 1065 { 1066 pthread_mutex_lock(&gethostbyname_lock); 1064 1067 memset(&hints, 0, sizeof(hints)); 1065 1068 hints.ai_socktype = SOCK_STREAM; … … 1069 1072 int err = getaddrinfo((const char*)account->dyndns, NULL, &hints, &res); 1070 1073 if (err != 0 || !res || !res->ai_addr) { 1071 cs_log("can't resolve %s, error: %s", account->dyndns, err ? gai_strerror(err) : "unknown");1072 }1074 cs_log("can't resolve %s, error: %s", account->dyndns, err ? gai_strerror(err) : "unknown"); 1075 } 1073 1076 else { 1074 1077 account->dynip=cs_inet_order(((struct sockaddr_in *)(res->ai_addr))->sin_addr.s_addr); 1075 1078 } 1076 1079 if (res) freeaddrinfo(res); 1080 pthread_mutex_unlock(&gethostbyname_lock); 1077 1081 } 1078 1082 sleep(cfg->resolvedelay);
Note:
See TracChangeset
for help on using the changeset viewer.