diff options
author | Wenxian Li <wenxianl@cisco.com> | 2015-09-10 00:39:04 -0400 |
---|---|---|
committer | Wenxian Li <wenxianl@cisco.com> | 2015-09-10 00:39:04 -0400 |
commit | 1dc0b240297cef767c82edc9673bd86573d4db55 (patch) | |
tree | d27fe9dbd29c8c5b72333e353fe0fef3c628af55 | |
parent | 8b0a8fcda7b2f28c4aee86c135e93529ade712eb (diff) |
fix some errors found by valgrind
-rwxr-xr-x | src/tuple_gen.cpp | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/tuple_gen.cpp b/src/tuple_gen.cpp index 309f6ebd..b9b156d0 100755 --- a/src/tuple_gen.cpp +++ b/src/tuple_gen.cpp @@ -235,51 +235,56 @@ void operator >> (const YAML::Node& node, CTupleGenPoolYaml & fi) { }else if (tmp == "normal") { fi.m_dist=cdNORMAL_DIST; } else { - printf("\ndist,seq\n"); fi.m_dist=cdSEQ_DIST; } utl_yaml_read_ip_addr(node,"ip_start",fi.m_ip_start); utl_yaml_read_ip_addr(node,"ip_end",fi.m_ip_end); + fi.m_number_of_clients_per_gb = 0; + + fi.m_min_clients = 0; + fi.m_is_bundling = false; + fi.m_tcp_aging_sec = 0; + fi.m_udp_aging_sec = 0; + fi.m_dual_interface_mask = 0; try { utl_yaml_read_uint32(node,"clients_per_gb",fi.m_number_of_clients_per_gb); } catch ( const std::exception& e ) { - fi.m_number_of_clients_per_gb = 0; - } + ;} try { utl_yaml_read_uint32(node,"min_clients",fi.m_min_clients); } catch ( const std::exception& e ) { - fi.m_min_clients = 0; - } + ;} try { utl_yaml_read_ip_addr(node,"dual_port_mask",fi.m_dual_interface_mask); } catch ( const std::exception& e ) { - fi.m_dual_interface_mask = 0; - } + ;} try { utl_yaml_read_uint16(node,"tcp_aging",fi.m_tcp_aging_sec); } catch ( const std::exception& e ) { - fi.m_tcp_aging_sec = 0; - } + ;} try { utl_yaml_read_uint16(node,"udp_aging",fi.m_udp_aging_sec); } catch ( const std::exception& e ) { - fi.m_udp_aging_sec = 0; - } + ;} try { node["track_ports"] >> fi.m_is_bundling; } catch ( const std::exception& e ) { - fi.m_is_bundling = false; - } + ;} } void copy_global_pool_para(CTupleGenPoolYaml & src, CTupleGenPoolYaml & dst) { + printf("src.m_number_of_clients_per_gb:%d\n",src.m_number_of_clients_per_gb); if (src.m_number_of_clients_per_gb == 0) src.m_number_of_clients_per_gb = dst.m_number_of_clients_per_gb; + printf("src.m_min_clients:%d\n",src.m_min_clients); if (src.m_min_clients == 0) src.m_min_clients = dst.m_min_clients; + printf("src.m_dual_interface_mask:%d\n",src.m_dual_interface_mask); if (src.m_dual_interface_mask == 0) src.m_dual_interface_mask = dst.m_dual_interface_mask; + printf("src.m_tcp_aging_sec:%d\n",src.m_tcp_aging_sec); if (src.m_tcp_aging_sec == 0) src.m_tcp_aging_sec = dst.m_tcp_aging_sec; + printf("src.m_udp_aging_sec:%d\n",src.m_udp_aging_sec); if (src.m_udp_aging_sec == 0) src.m_udp_aging_sec = dst.m_udp_aging_sec; } @@ -320,13 +325,13 @@ void operator >> (const YAML::Node& node, CTupleGenYamlInfo & fi) { CTupleGenPoolYaml pool; try { c_pool_info[idx] >> pool; + if (fi.m_client_pool.size()>0) { + copy_global_pool_para(pool, fi.m_client_pool[0]); + } + fi.m_client_pool.push_back(pool); } catch ( const std::exception& e ) { printf("client pool in YAML is wrong\n"); } - if (fi.m_client_pool.size()>0) { - copy_global_pool_para(pool, fi.m_client_pool[0]); - } - fi.m_client_pool.push_back(pool); } }catch ( const std::exception& e ) { printf("no client generator pool configured, using default pool\n"); |