Changeset 8015
- Timestamp:
- 12/30/12 16:54:04 (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-cccam.c
r8002 r8015 2085 2085 uint16_t size = buf[12] | (buf[13] << 8); 2086 2086 if (size != sizeof(er->ecmd5) + sizeof(er->csp_hash) + sizeof(er->cw)) { 2087 cs_ log("%s received wrong cash-push format! data ignored!", username(cl));2087 cs_debug_mask(D_CACHEEX,"%s received wrong cache-push format! data ignored!", username(cl)); 2088 2088 return; 2089 2089 } -
trunk/oscam-garbage.c
r8014 r8015 84 84 cs_writelock(&garbage_lock[i]); 85 85 now = time(NULL); 86 87 prev = NULL; 88 garbage = garbage_first[i]; 89 while (garbage) { 90 next = garbage->next; 91 if (now > (time_t)(garbage->time+2*cfg.ctimeout/1000+1)) { //clienttimeout +1 second 92 free(garbage->data); 93 94 if (prev) 95 prev->next = next; 96 else 97 garbage_first[i] = next; 98 free(garbage); 99 } 100 else 101 prev = garbage; 102 garbage = next; 86 time_t deltime = time((time_t)0) - (2*cfg.ctimeout/1000 + 1); //clienttimeout +1 second 87 for(garbage = garbage_first[i], prev = NULL; garbage; prev = garbage, garbage = garbage->next) { 88 if (deltime < garbage->time) { 89 continue; 90 } 91 if (prev) { 92 prev->next = NULL; 93 } else { 94 garbage_first[i] = NULL; 95 } 96 break; 97 //all follow older and we can leave lock 103 98 } 104 99 cs_writeunlock(&garbage_lock[i]); 100 while(garbage){ 101 next = garbage->next; 102 free(garbage->data); 103 free(garbage); 104 garbage = next; 105 } 105 106 } 106 107 cs_sleepms(1000); -
trunk/oscam-log.c
r7954 r8015 324 324 void cs_log_int(uint16_t mask, int8_t lock __attribute__((unused)), const uchar *buf, int32_t n, const char *fmt, ...) 325 325 { 326 va_list params; 327 328 static char log_txt[LOG_BUF_SIZE], dupl[LOG_BUF_SIZE/4]; 329 int32_t dupl_header_len, repeated_line, i, len = 0; 330 pthread_mutex_lock(&log_mutex); 331 if (fmt && (mask & cs_dblevel) == mask) 332 { 333 va_start(params, fmt); 334 len = get_log_header(1, log_txt); 335 vsnprintf(log_txt + len, sizeof(log_txt) - len, fmt, params); 336 va_end(params); 337 repeated_line = strcmp(last_log_txt, log_txt + len) == 0; 338 if (last_log_duplicates > 0) { 339 if (!last_log_ts) // Must be initialized once 340 last_log_ts = log_ts; 341 // Report duplicated lines when the new log line is different 342 // than the old or 60 seconds have passed. 343 if (!repeated_line || log_ts - last_log_ts >= 60) { 344 dupl_header_len = get_log_header(2, dupl); 345 snprintf(dupl + dupl_header_len - 1, sizeof(dupl) - dupl_header_len, "--- Skipped %u duplicated log lines ---", last_log_duplicates); 346 write_to_log_int(dupl, 0); 347 last_log_duplicates = 0; 348 last_log_ts = log_ts; 349 } 350 } 351 if (!repeated_line) { 352 memcpy(last_log_txt, log_txt + len, LOG_BUF_SIZE); 353 write_to_log_int(log_txt, len); 354 } else { 355 last_log_duplicates++; 356 } 357 } 358 if (buf && ((mask & cs_dblevel) || !mask)) 359 { 360 for (i=0; i<n; i+=16) 326 if ((mask & cs_dblevel) || !mask ) { 327 va_list params; 328 329 static char log_txt[LOG_BUF_SIZE], dupl[LOG_BUF_SIZE/4]; 330 int32_t dupl_header_len, repeated_line, i, len = 0; 331 pthread_mutex_lock(&log_mutex); 332 if (fmt) 361 333 { 362 len = get_log_header(0, log_txt); 363 cs_hexdump(1, buf+i, (n-i>16) ? 16 : n-i, log_txt + len, sizeof(log_txt) - len); 364 write_to_log_int(log_txt, len); 365 } 366 } 367 pthread_mutex_unlock(&log_mutex); 334 va_start(params, fmt); 335 len = get_log_header(1, log_txt); 336 vsnprintf(log_txt + len, sizeof(log_txt) - len, fmt, params); 337 va_end(params); 338 repeated_line = strcmp(last_log_txt, log_txt + len) == 0; 339 if (last_log_duplicates > 0) { 340 if (!last_log_ts) // Must be initialized once 341 last_log_ts = log_ts; 342 // Report duplicated lines when the new log line is different 343 // than the old or 60 seconds have passed. 344 if (!repeated_line || log_ts - last_log_ts >= 60) { 345 dupl_header_len = get_log_header(2, dupl); 346 snprintf(dupl + dupl_header_len - 1, sizeof(dupl) - dupl_header_len, "--- Skipped %u duplicated log lines ---", last_log_duplicates); 347 write_to_log_int(dupl, 0); 348 last_log_duplicates = 0; 349 last_log_ts = log_ts; 350 } 351 } 352 if (!repeated_line) { 353 memcpy(last_log_txt, log_txt + len, LOG_BUF_SIZE); 354 write_to_log_int(log_txt, len); 355 } else { 356 last_log_duplicates++; 357 } 358 } 359 if (buf) 360 { 361 for (i=0; i<n; i+=16) 362 { 363 len = get_log_header(0, log_txt); 364 cs_hexdump(1, buf+i, (n-i>16) ? 16 : n-i, log_txt + len, sizeof(log_txt) - len); 365 write_to_log_int(log_txt, len); 366 } 367 } 368 pthread_mutex_unlock(&log_mutex); 369 } 368 370 } 369 371 -
trunk/oscam.c
r8001 r8015 3227 3227 time_t diff = (time_t)(cfg.ctimeout/1000)+1; 3228 3228 if (data != &tmp_data && data->time < now-diff) { 3229 cs_ log("dropping client data for %s time %ds", username(cl), (int32_t)(now-data->time));3229 cs_debug_mask(D_TRACE, "dropping client data for %s time %ds", username(cl), (int32_t)(now-data->time)); 3230 3230 free_data(data); 3231 3231 data = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.