MSEC
MSEC copied to clipboard
fatal bug: 除零错误
在测试nlb/src/api/nlbapi_test.c的时候发现: nlb/src/api/nlbapi.c: calc_success_ratio最后一步req_total结果为0!!!
修改为:
float calc_success_ratio(struct shm_servers *shm_servers, struct server_info *server)
{
uint32_t req_total;
req_total = server->failed + server->success;
if (req_total < shm_servers->shaping_request_min) {
return 100.0;
}
return ((float)server->success) / (req_total == 0 ? 1e-6f : (float)(req_total));
}