| 72 | } |
| 73 | |
| 74 | bool FreqCtrlBucket::HasToken(int * for_check) { |
| 75 | uint32_t last_refill_time = (unsigned int) time(NULL); |
| 76 | last_refill_time = last_refill_time - last_refill_time % (db_token_.period); |
| 77 | |
| 78 | if (db_bucket_struct_.last_refill_time != last_refill_time) { |
| 79 | db_bucket_struct_.last_refill_time = last_refill_time; |
| 80 | db_bucket_struct_.read_bucket = db_token_.read_token; |
| 81 | db_bucket_struct_.write_bucket = db_token_.write_token; |
| 82 | } |
| 83 | |
| 84 | return *for_check > 0; |
| 85 | } |
| 86 | |
| 87 | bool FreqCtrlBucket::HasReadToken() { |
| 88 | return HasToken(&db_bucket_struct_.read_bucket); |
nothing calls this directly
no outgoing calls
no test coverage detected