File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -434,22 +434,26 @@ int CMain::ReadConfig()
434434 json_value *pNJsonData = json_parse_ex (&nJsonSettings, pNFileData, strlen (pNFileData), aError);
435435 if (pNJsonData)
436436 {
437- const json_value &rStart = (*pNJsonData)[" servers" ];
437+ const json_value &cStart = (*pNJsonData)[" servers" ];
438438 if (rStart.type == json_array)
439439 {
440440 int ID = 0 ;
441441 for (unsigned i = 0 ; i < rStart.u .array .length ; i++)
442442 {
443443 if (ID < 0 || ID >= NET_MAX_CLIENTS)
444444 continue ;
445-
446- // check name and host for match , when ServerStatus reload month traffic.
447- if (strcmp (Client (ID)->m_aName , rStart[i][" name" ].u .string .ptr )==0 && strcmp (Client (ID)->m_aHost , rStart[i][" host" ].u .string .ptr )==0 )
445+ for (unsigned j = 0 ; j < cStart.u .array .length ; j++)
448446 {
449- Client (ID)->m_LastNetworkIN = rStart[i][" last_network_in" ].u .integer ;
450- Client (ID)->m_LastNetworkOUT = rStart[i][" last_network_out" ].u .integer ;
447+ if (strcmp (Client (ID)->m_aName , cStart[j][" name" ].u .string .ptr )==0 &&
448+ strcmp (Client (ID)->m_aType , cStart[j][" type" ].u .string .ptr )==0 &&
449+ strcmp (Client (ID)->m_aHost , cStart[j][" host" ].u .string .ptr )==0 &&
450+ strcmp (Client (ID)->m_aLocation , cStart[j][" location" ].u .string .ptr )==0 )
451+ {
452+ Client (ID)->m_LastNetworkIN = cStart[j][" last_network_in" ].u .integer ;
453+ Client (ID)->m_LastNetworkOUT = cStart[j][" last_network_out" ].u .integer ;
454+ break ;
455+ }
451456 }
452-
453457 ID++;
454458 }
455459 }
You can’t perform that action at this time.
0 commit comments