~ps10gel/ubuntu/xenial/trafficserver/6.2.0

« back to all changes in this revision

Viewing changes to proxy/IPAllow.cc

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2013-05-09 01:00:04 UTC
  • mto: (1.1.11) (5.3.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: package-import@ubuntu.com-20130509010004-9fqq9n0adseg3f8w
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
 
52
52
int IpAllow::configid = 0;
53
53
 
54
 
static Ptr<ProxyMutex> ip_reconfig_mutex;
55
 
 
56
 
// struct IpAllowUpdate
57
 
//
58
 
//   Used to read the ip_allow.conf file after the manager signals
59
 
//      a change
60
 
//
61
 
struct IpAllowUpdate: public Continuation
62
 
{
63
 
  int update(int /* etype */, void * /* data */) {
64
 
    IpAllow::ReloadInstance();
65
 
    delete this;
66
 
    return EVENT_DONE;
67
 
  }
68
 
 
69
 
  IpAllowUpdate(ProxyMutex * m):Continuation(m) {
70
 
    SET_HANDLER(&IpAllowUpdate::update);
71
 
  }
72
 
};
73
 
 
74
 
int
75
 
ipAllowFile_CB(const char *name, RecDataT data_type, RecData data, void *cookie)
76
 
{
77
 
  NOWARN_UNUSED(name);
78
 
  NOWARN_UNUSED(data_type);
79
 
  NOWARN_UNUSED(data);
80
 
  NOWARN_UNUSED(cookie);
81
 
  eventProcessor.schedule_imm(NEW(new IpAllowUpdate(ip_reconfig_mutex)), ET_CACHE);
82
 
  return 0;
83
 
}
 
54
static ConfigUpdateHandler<IpAllow> * ipAllowUpdate;
84
55
 
85
56
//
86
57
//   Begin API functions
87
58
//
88
59
void
89
 
IpAllow::InitInstance()
 
60
IpAllow::startup()
90
61
{
91
62
  // Should not have been initialized before
92
63
  ink_assert(IpAllow::configid == 0);
93
64
 
94
65
  ALL_METHOD_MASK = ~0;
95
66
 
96
 
  ip_reconfig_mutex = new_ProxyMutex();
97
 
  REC_RegisterConfigUpdateFunc("proxy.config.cache.ip_allow.filename", ipAllowFile_CB, NULL);
98
 
  ReloadInstance();
 
67
  ipAllowUpdate = NEW(new ConfigUpdateHandler<IpAllow>());
 
68
  ipAllowUpdate->attach("proxy.config.cache.ip_allow.filename");
 
69
 
 
70
  reconfigure();
99
71
}
100
72
 
101
73
void
102
 
IpAllow::ReloadInstance()
 
74
IpAllow::reconfigure()
103
75
{
104
76
  self *new_table;
105
77