anchor.diff:  -define(GEO_TABLE, mt_geo).
   -define(GEO_MANAGER, geoman).
   -define(SNAPSHOT_INTV, 86400000).
  --define(WRITEBACK_THR, 100000).
   -define(HIGH_WATER_MARK, 1000).
   
   init(careful) ->
       ets:new(?IPS_TABLE, [set, public, named_table]),
       ets:new(?GEO_TABLE, [set, public, named_table]),
       ets:insert(?IPS_TABLE, {count, 0}),
  -    ets:insert(?GEO_TABLE, {{ips,      count}, 0}),
  +    ets:insert(?GEO_TABLE, {{isp,      count}, 0}),
       ets:insert(?GEO_TABLE, {{country,  count}, 0}),
       ets:insert(?GEO_TABLE, {{province, count}, 0}),
       ets:insert(?GEO_TABLE, {{city,     count}, 0}),
  
positive.code:     ok.
  
  start(Port, Procs) ->
      inets:start(),
      error_logger:logfile({open, ?LOG_FILE}),
      {ok, ?IPS_TABLE} = ets:file2tab(?IPS_FILE),
      {ok, ?GEO_TABLE} = ets:file2tab(?GEO_FILE),
      GeoMan = spawn(geoman),
      register(?GEO_MANAGER, GeoMan),
      lists:map(fun worker_init/1, [0, Procs-1]),
      {ok, LSock} = gen_tcp:listen(Port, [{active, false}, {packet, http}]),
      loop(LSock, Procs).
  
  %% ======== Internal Functions ======== %%
  
  
negative.code:     {A, B, C, D} = inet:parse_ipv4_address(IP),
      Key = (A bsl 16) + (B bsl 8) + C,
      case ets:lookup(?IPS_TABLE, Key) of
          [{_, Value}] ->
              L = 255 - D,
              <<_:2, ISP:10, Country:8, Province:12, City:16,
                County:16, _:L, X:1, _:D>> = Value,
              case X of
                  1 ->
                      Geo = id_to_name(ISP, Country, Province, City, County),
                      {200, format([IP | Geo])};
                  0 ->
                      case ets:lookup(?IPS_TABLE, (Key bsl 8) + D) of
                          [{_, Value2}] ->
                              <<_:2, ISP2:10, Country2:8, Province2:12, 
                                City2:16, County2:16>> = Value2,
                              Geo2 = id_to_name(ISP2, Country2, Province2,
                                                City2, County2),
                              {200, format([IP | Geo2])};
                          [] -> taobao_api(IP)
                      end
              end;
          [] -> taobao_api(IP)
      end.
  
  taobao_api(IP) ->
      URL = "http://ip.taobao.com/service/getIpInfo.php?ip=" ++ IP,
  