projects
/
yazproxy-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2687af6
)
period-connect which specifies the period we do connect statistics
author
Adam Dickmeiss
<adam@indexdata.dk>
Thu, 6 Apr 2006 16:25:20 +0000
(16:25 +0000)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Thu, 6 Apr 2006 16:25:20 +0000
(16:25 +0000)
etc/config.xml
patch
|
blob
|
history
include/yazproxy/limit-connect.h
patch
|
blob
|
history
include/yazproxy/proxy.h
patch
|
blob
|
history
src/limit-connect.cpp
patch
|
blob
|
history
src/proxyp.h
patch
|
blob
|
history
src/yaz-proxy-config.cpp
patch
|
blob
|
history
src/yaz-proxy.cpp
patch
|
blob
|
history
diff --git
a/etc/config.xml
b/etc/config.xml
index
7b3cf3c
..
c48eab2
100644
(file)
--- a/
etc/config.xml
+++ b/
etc/config.xml
@@
-1,5
+1,5
@@
<?xml version="1.0"?>
<?xml version="1.0"?>
-<!-- $Id: config.xml,v 1.18 2006-04-06 12:04:19 adam Exp $ -->
+<!-- $Id: config.xml,v 1.19 2006-04-06 16:25:20 adam Exp $ -->
<proxy xmlns="http://indexdata.dk/yazproxy/schema/0.9/"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<proxy xmlns="http://indexdata.dk/yazproxy/schema/0.9/"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@
-49,6
+49,7
@@
</target>
<max-clients>30</max-clients>
<max-connect>10</max-connect>
</target>
<max-clients>30</max-clients>
<max-connect>10</max-connect>
+ <period-connect>10</period-connect>
<limit-connect>5</limit-connect>
<log>client-requests server-requests client-ip</log>
<docpath>doc</docpath>
<limit-connect>5</limit-connect>
<log>client-requests server-requests client-ip</log>
<docpath>doc</docpath>
diff --git
a/include/yazproxy/limit-connect.h
b/include/yazproxy/limit-connect.h
index
7efaf58
..
a557502
100644
(file)
--- a/
include/yazproxy/limit-connect.h
+++ b/
include/yazproxy/limit-connect.h
@@
-1,4
+1,4
@@
-/* $Id: limit-connect.h,v 1.2 2006-03-30 14:16:34 adam Exp $
+/* $Id: limit-connect.h,v 1.3 2006-04-06 16:25:21 adam Exp $
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
@@
-32,6
+32,7
@@
public:
void add_connect(const char *peername);
int get_total(const char *peername);
void cleanup(bool all);
void add_connect(const char *peername);
int get_total(const char *peername);
void cleanup(bool all);
+ void set_period(int sec);
private:
struct Peer;
private:
struct Peer;
diff --git
a/include/yazproxy/proxy.h
b/include/yazproxy/proxy.h
index
07d6b08
..
e80924f
100644
(file)
--- a/
include/yazproxy/proxy.h
+++ b/
include/yazproxy/proxy.h
@@
-1,4
+1,4
@@
-/* $Id: proxy.h,v 1.31 2006-04-06 12:04:19 adam Exp $
+/* $Id: proxy.h,v 1.32 2006-04-06 16:25:21 adam Exp $
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
@@
-108,8
+108,10
@@
class YAZ_EXPORT Yaz_Proxy : public yazpp_1::Z_Assoc {
} m_timeout_mode;
int m_initial_reduce;
} m_timeout_mode;
int m_initial_reduce;
- int m_connect_max;
+ int m_max_connect;
+ int m_max_connect_period;
int m_limit_connect;
int m_limit_connect;
+ int m_limit_connect_period;
int m_search_max;
Yaz_bw m_bw_stat;
int m_pdu_max;
int m_search_max;
Yaz_bw m_bw_stat;
int m_pdu_max;
diff --git
a/src/limit-connect.cpp
b/src/limit-connect.cpp
index
9197ea3
..
270d567
100644
(file)
--- a/
src/limit-connect.cpp
+++ b/
src/limit-connect.cpp
@@
-1,4
+1,4
@@
-/* $Id: limit-connect.cpp,v 1.1 2006-03-30 10:35:15 adam Exp $
+/* $Id: limit-connect.cpp,v 1.2 2006-04-06 16:25:21 adam Exp $
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
@@
-43,11
+43,17
@@
LimitConnect::LimitConnect()
m_peers = 0;
}
m_peers = 0;
}
+
LimitConnect::~LimitConnect()
{
cleanup(true);
}
LimitConnect::~LimitConnect()
{
cleanup(true);
}
+void LimitConnect::set_period(int sec)
+{
+ m_period = sec;
+}
+
LimitConnect::Peer::Peer(int sz, const char *peername) : m_bw(sz)
{
m_peername = xstrdup(peername);
LimitConnect::Peer::Peer(int sz, const char *peername) : m_bw(sz)
{
m_peername = xstrdup(peername);
diff --git
a/src/proxyp.h
b/src/proxyp.h
index
c412566
..
8a94f9a
100644
(file)
--- a/
src/proxyp.h
+++ b/
src/proxyp.h
@@
-1,4
+1,4
@@
-/* $Id: proxyp.h,v 1.15 2006-04-06 01:16:55 adam Exp $
+/* $Id: proxyp.h,v 1.16 2006-04-06 16:25:21 adam Exp $
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
@@
-105,7
+105,8
@@
public:
const char **default_client_query_charset);
void get_generic_info(int *log_mask, int *max_clients,
const char **default_client_query_charset);
void get_generic_info(int *log_mask, int *max_clients,
- int *max_connect, int *limit_connect);
+ int *max_connect, int *limit_connect,
+ int *period_connect);
int get_file_access_info(const char *path);
int get_file_access_info(const char *path);
diff --git
a/src/yaz-proxy-config.cpp
b/src/yaz-proxy-config.cpp
index
ec7e396
..
dbf03a5
100644
(file)
--- a/
src/yaz-proxy-config.cpp
+++ b/
src/yaz-proxy-config.cpp
@@
-1,4
+1,4
@@
-/* $Id: yaz-proxy-config.cpp,v 1.29 2006-04-06 12:04:19 adam Exp $
+/* $Id: yaz-proxy-config.cpp,v 1.30 2006-04-06 16:25:21 adam Exp $
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
@@
-55,6
+55,7
@@
class Yaz_ProxyConfigP {
xmlNodePtr find_target_node(const char *name, const char *db);
xmlNodePtr find_target_db(xmlNodePtr ptr, const char *db);
const char *get_text(xmlNodePtr ptr);
xmlNodePtr find_target_node(const char *name, const char *db);
xmlNodePtr find_target_db(xmlNodePtr ptr, const char *db);
const char *get_text(xmlNodePtr ptr);
+ void get_period(xmlNodePtr ptr, int *period);
int check_type_1_attributes(ODR odr, xmlNodePtr ptr,
Z_AttributeList *attrs,
char **addinfo);
int check_type_1_attributes(ODR odr, xmlNodePtr ptr,
Z_AttributeList *attrs,
char **addinfo);
@@
-165,6
+166,18
@@
const char *Yaz_ProxyConfigP::get_text(xmlNodePtr ptr)
}
return 0;
}
}
return 0;
}
+
+void Yaz_ProxyConfigP::get_period(xmlNodePtr ptr, int *period)
+{
+ struct _xmlAttr *attr;
+ *period = 60;
+ for (attr = ptr->properties; attr; attr = attr->next)
+ {
+ if (!strcmp((const char *) attr->name, "period") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ *period = atoi((const char *) attr->children->content);
+ }
+}
#endif
#if HAVE_XSLT
#endif
#if HAVE_XSLT
@@
-1008,7
+1021,8
@@
int Yaz_ProxyConfig::get_file_access_info(const char *path)
void Yaz_ProxyConfig::get_generic_info(int *log_mask,
int *max_clients,
int *max_connect,
void Yaz_ProxyConfig::get_generic_info(int *log_mask,
int *max_clients,
int *max_connect,
- int *limit_connect)
+ int *limit_connect,
+ int *period_connect)
{
*max_connect = 0;
*limit_connect = 0;
{
*max_connect = 0;
*limit_connect = 0;
@@
-1060,18
+1074,29
@@
void Yaz_ProxyConfig::get_generic_info(int *log_mask,
}
}
else if (ptr->type == XML_ELEMENT_NODE &&
}
}
else if (ptr->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr->name, "period-connect"))
+ {
+ const char *t = m_cp->get_text(ptr);
+ if (t)
+ *period_connect = atoi(t);
+ }
+ else if (ptr->type == XML_ELEMENT_NODE &&
!strcmp((const char *) ptr->name, "max-connect"))
{
const char *t = m_cp->get_text(ptr);
if (t)
!strcmp((const char *) ptr->name, "max-connect"))
{
const char *t = m_cp->get_text(ptr);
if (t)
+ {
*max_connect = atoi(t);
*max_connect = atoi(t);
+ }
}
else if (ptr->type == XML_ELEMENT_NODE &&
!strcmp((const char *) ptr->name, "limit-connect"))
{
const char *t = m_cp->get_text(ptr);
if (t)
}
else if (ptr->type == XML_ELEMENT_NODE &&
!strcmp((const char *) ptr->name, "limit-connect"))
{
const char *t = m_cp->get_text(ptr);
if (t)
+ {
*limit_connect = atoi(t);
*limit_connect = atoi(t);
+ }
}
else if (ptr->type == XML_ELEMENT_NODE &&
!strcmp((const char *) ptr->name, "target"))
}
else if (ptr->type == XML_ELEMENT_NODE &&
!strcmp((const char *) ptr->name, "target"))
diff --git
a/src/yaz-proxy.cpp
b/src/yaz-proxy.cpp
index
a6930ea
..
5de2824
100644
(file)
--- a/
src/yaz-proxy.cpp
+++ b/
src/yaz-proxy.cpp
@@
-1,4
+1,4
@@
-/* $Id: yaz-proxy.cpp,v 1.50 2006-04-06 12:04:20 adam Exp $
+/* $Id: yaz-proxy.cpp,v 1.51 2006-04-06 16:25:21 adam Exp $
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
Copyright (c) 1998-2006, Index Data.
This file is part of the yazproxy.
@@
-232,8
+232,10
@@
Yaz_Proxy::Yaz_Proxy(IPDU_Observable *the_PDU_Observable,
m_bw_max = 0;
m_pdu_max = 0;
m_search_max = 0;
m_bw_max = 0;
m_pdu_max = 0;
m_search_max = 0;
- m_connect_max = 0;
+ m_max_connect = 0;
+ m_max_connect_period = 0;
m_limit_connect = 0;
m_limit_connect = 0;
+ m_limit_connect_period = 0;
m_timeout_mode = timeout_normal;
m_timeout_gdu = 0;
m_max_record_retrieve = 0;
m_timeout_mode = timeout_normal;
m_timeout_gdu = 0;
m_max_record_retrieve = 0;
@@
-354,8
+356,12
@@
int Yaz_Proxy::set_config(const char *config)
m_config_fname = xstrdup(config);
int r = m_config->read_xml(config);
if (!r)
m_config_fname = xstrdup(config);
int r = m_config->read_xml(config);
if (!r)
+ {
+ int period = 60;
m_config->get_generic_info(&m_log_mask, &m_max_clients,
m_config->get_generic_info(&m_log_mask, &m_max_clients,
- &m_connect_max, &m_limit_connect);
+ &m_max_connect, &m_limit_connect, &period);
+ m_connect.set_period(period);
+ }
return r;
}
return r;
}
@@
-406,8
+412,11
@@
Yaz_ProxyConfig *Yaz_Proxy::check_reconfigure()
else
{
m_log_mask = 0;
else
{
m_log_mask = 0;
+ int period = 60;
cfg->get_generic_info(&m_log_mask, &m_max_clients,
cfg->get_generic_info(&m_log_mask, &m_max_clients,
- &m_connect_max, &m_limit_connect);
+ &m_max_connect, &m_limit_connect,
+ &period);
+ m_connect.set_period(period);
}
}
else
}
}
else
@@
-438,7
+447,7
@@
IPDU_Observer *Yaz_Proxy::sessionNotify(IPDU_Observable
m_connect.add_connect(peername);
int connect_total = m_connect.get_total(peername);
m_connect.add_connect(peername);
int connect_total = m_connect.get_total(peername);
- int connect_max = m_connect_max;
+ int connect_max = m_max_connect;
if (connect_max && connect_total > connect_max)
{
yaz_log(YLOG_LOG, "%sconnect not accepted total=%d max=%d",
if (connect_max && connect_total > connect_max)
{
yaz_log(YLOG_LOG, "%sconnect not accepted total=%d max=%d",