mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-23 19:39:06 +00:00
added config settings min_port_monitors & min_port_monitor_connections
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@388 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
cfb93cb417
commit
1e8254687e
100
README
100
README
@ -4,16 +4,16 @@ conky(1) conky(1)
|
||||
|
||||
NAME
|
||||
conky - A system monitor for X originally based on the torsmo code, but
|
||||
more kickass. It just keeps on given'er. Yeah.
|
||||
more kickass. It just keeps on given’er. Yeah.
|
||||
|
||||
SYNOPSIS
|
||||
conky [options]
|
||||
|
||||
DESCRIPTION
|
||||
Conky is a system monitor for X originally based on the torsmo code.
|
||||
Since it's original conception, Conky has changed a fair bit from it's
|
||||
Since it’s original conception, Conky has changed a fair bit from it’s
|
||||
predecessor. Conky can display just about anything, either on your
|
||||
root desktop or in it's own window. Conky has many built-in objects,
|
||||
root desktop or in it’s own window. Conky has many built-in objects,
|
||||
as well as the ability to execute programs and scripts, then display
|
||||
the output from stdout.
|
||||
|
||||
@ -28,11 +28,11 @@ COMPILING
|
||||
libraries installed. This should be a package along the lines of
|
||||
"libx11-dev or xorg-x11-dev".
|
||||
|
||||
Gentoo users -- Conky is in Gentoo's Portage... simply use "emerge app-
|
||||
Gentoo users -- Conky is in Gentoo’s Portage... simply use "emerge app-
|
||||
admin/conky" for installation. There is also usually an up-to-date
|
||||
ebuild within Conky's package or in CVS.
|
||||
ebuild within Conky’s package or in CVS.
|
||||
|
||||
Debian,etc. users -- Conky will be in Debian's repositories soon (by
|
||||
Debian,etc. users -- Conky will be in Debian’s repositories soon (by
|
||||
mid-September, hopefully), and then Ubuntu shortly thereafter. Until
|
||||
then, "dpkg -i" the .deb package to install.
|
||||
|
||||
@ -43,7 +43,7 @@ COMPILING
|
||||
|
||||
./configure --prefix=/usr --mandir=/usr/share/man
|
||||
--infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
|
||||
--localstatedir=/var/lib --enable-xft --enable-seti --enable-dou-
|
||||
--localstatedir=/var/lib --enable-xft --enable-seti --enable-dou‐
|
||||
ble-buffer --enable-own-window --enable-proc-uptime --enable-mpd
|
||||
--enable-mldonkey --enable-x11 --enable-portmon
|
||||
|
||||
@ -53,14 +53,14 @@ COMPILING
|
||||
|
||||
src/conky
|
||||
|
||||
Conky probably doesn't compile with compilers other than gcc and icc.
|
||||
It doesn't compile with C89 compiler and not even with pure C99. It
|
||||
uses a few things that might not exist: strdup(), strcasecmp(), strn-
|
||||
Conky probably doesn’t compile with compilers other than gcc and icc.
|
||||
It doesn’t compile with C89 compiler and not even with pure C99. It
|
||||
uses a few things that might not exist: strdup(), strcasecmp(), strn‐
|
||||
casecmp(), optarg variable with getopt() and long long (not in C89).
|
||||
Crashes in file system statistics stuff when compiled with icc, I don't
|
||||
Crashes in file system statistics stuff when compiled with icc, I don’t
|
||||
know exactly why.
|
||||
|
||||
You can disable 'drawing to own window' feature in case you don't need
|
||||
You can disable ’drawing to own window’ feature in case you don’t need
|
||||
it by passing --disable-own-window to configure -script.
|
||||
|
||||
|
||||
@ -71,14 +71,14 @@ YOU SHOULD KNOW
|
||||
rest of Conky.
|
||||
|
||||
If you do use them, please do not complain about memory or CPU usage,
|
||||
unless you think something's seriously wrong (mem leak, etc.).
|
||||
unless you think something’s seriously wrong (mem leak, etc.).
|
||||
|
||||
An easy way to force Conky to reload your ~/.conkyrc: "killall -SIGUSR1
|
||||
conky". Saves you the trouble of having to kill and then restart.
|
||||
|
||||
IMPORTANT: For previous Conky users, Conky 1.3 no longer supports the
|
||||
metar stuff. mdsplib was causing way too many problems. Hopefully
|
||||
there'll be a better solution in Conky 2.x...
|
||||
there’ll be a better solution in Conky 2.x...
|
||||
|
||||
OPTIONS
|
||||
Command line options override configurations defined in configuration
|
||||
@ -113,7 +113,7 @@ OPTIONS
|
||||
|
||||
|
||||
-t TEXT
|
||||
Text to render, remember single quotes, like -t ' $uptime '
|
||||
Text to render, remember single quotes, like -t ’ $uptime ’
|
||||
|
||||
|
||||
-u SECONDS
|
||||
@ -135,14 +135,14 @@ OPTIONS
|
||||
CONFIGURATION SETTINGS
|
||||
Default configuration file is $HOME/.conkyrc (can be changed from
|
||||
conky.c among other things). See conkyrc.sample. If installing from
|
||||
Debian package, this should be in /usr/share/doc/conky/examples ("gun-
|
||||
Debian package, this should be in /usr/share/doc/conky/examples ("gun‐
|
||||
zip conkyrc.sample.gz" to get conkyrc.sample).
|
||||
|
||||
You might want to copy it to $HOME/.conkyrc and then start modifying
|
||||
it. Other configs can be found at http://conky.sf.net
|
||||
|
||||
alignment
|
||||
Aligned position on screen, may be top_left, top_right, bot-
|
||||
Aligned position on screen, may be top_left, top_right, bot‐
|
||||
tom_left, bottom_right, or none
|
||||
|
||||
|
||||
@ -172,7 +172,7 @@ CONFIGURATION SETTINGS
|
||||
|
||||
|
||||
default_shade_color
|
||||
Default shading color and border's shading color
|
||||
Default shading color and border’s shading color
|
||||
|
||||
|
||||
default_outline_color
|
||||
@ -180,8 +180,8 @@ CONFIGURATION SETTINGS
|
||||
|
||||
|
||||
double_buffer
|
||||
Use the Xdbe extension? (eliminates flicker) It is highly recom-
|
||||
mended to use own window with this one so double buffer won't be
|
||||
Use the Xdbe extension? (eliminates flicker) It is highly recom‐
|
||||
mended to use own window with this one so double buffer won’t be
|
||||
so big.
|
||||
|
||||
|
||||
@ -305,13 +305,23 @@ CONFIGURATION SETTINGS
|
||||
Use Xft (anti-aliased font and stuff)
|
||||
|
||||
|
||||
min_port_monitors
|
||||
Allow for the creation of at least this number of port monitors
|
||||
(if 0 or not set, default is 16)
|
||||
|
||||
|
||||
min_port_monitor_connections
|
||||
Allow each port monitor to track at least this many connections
|
||||
(if 0 or not set, default is 256)
|
||||
|
||||
|
||||
TEXT After this begins text to be formatted on screen
|
||||
|
||||
|
||||
VARIABLES
|
||||
Colors are parsed using XParsecolor(), there might be a list of them:
|
||||
/usr/X11R6/lib/X11/rgb.txt. Also, http://sedition.com/perl/rgb.html
|
||||
[http://sedition.com/perl/rgb.html]. Color can be also in #rrggbb for-
|
||||
[http://sedition.com/perl/rgb.html]. Color can be also in #rrggbb for‐
|
||||
mat (hex). Note that when displaying bytes, power is 1024 and not 1000
|
||||
so 1M really means 1024*1024 bytes and not 1000*1000.
|
||||
|
||||
@ -387,7 +397,7 @@ VARIABLES
|
||||
|
||||
|
||||
cpubar (cpu number) (height),(width)
|
||||
Bar that shows CPU usage, height is bar's height in pixels. See
|
||||
Bar that shows CPU usage, height is bar’s height in pixels. See
|
||||
$cpu for more info on SMP.
|
||||
|
||||
|
||||
@ -424,8 +434,8 @@ VARIABLES
|
||||
|
||||
|
||||
exec command
|
||||
Executes a shell command and displays the output in conky. warn-
|
||||
ing: this takes a lot more resources than other variables. I'd
|
||||
Executes a shell command and displays the output in conky. warn‐
|
||||
ing: this takes a lot more resources than other variables. I’d
|
||||
recommend coding wanted behaviour in C and posting a patch.
|
||||
|
||||
|
||||
@ -440,7 +450,7 @@ VARIABLES
|
||||
|
||||
|
||||
execi interval command
|
||||
Same as exec but with specific interval. Interval can't be less
|
||||
Same as exec but with specific interval. Interval can’t be less
|
||||
than update_interval in configuration. See also $texeci
|
||||
|
||||
|
||||
@ -497,7 +507,7 @@ VARIABLES
|
||||
|
||||
head logfile lines (interval)
|
||||
Displays first N lines of supplied text text file. If interval
|
||||
is not supplied, Conky assumes 2x Conky's interval. Max of 30
|
||||
is not supplied, Conky assumes 2x Conky’s interval. Max of 30
|
||||
lines can be displayed, or until the text buffer is filled.
|
||||
|
||||
|
||||
@ -542,7 +552,7 @@ VARIABLES
|
||||
|
||||
i8k_left_fan_rpm
|
||||
If running the i8k kernel driver for Inspiron laptops, displays
|
||||
the left fan's rate of rotation, in revolutions per minute as
|
||||
the left fan’s rate of rotation, in revolutions per minute as
|
||||
listed in /proc/i8k. Beware, some laptops i8k reports these fans
|
||||
in reverse order.
|
||||
|
||||
@ -556,7 +566,7 @@ VARIABLES
|
||||
|
||||
i8k_right_fan_rpm
|
||||
If running the i8k kernel driver for Inspiron laptops, displays
|
||||
the right fan's rate of rotation, in revolutions per minute as
|
||||
the right fan’s rate of rotation, in revolutions per minute as
|
||||
listed in /proc/i8k. Beware, some laptops i8k reports these fans
|
||||
in reverse order.
|
||||
|
||||
@ -637,7 +647,7 @@ VARIABLES
|
||||
|
||||
|
||||
mpd_bar (height),(width)
|
||||
Bar of mpd's progress
|
||||
Bar of mpd’s progress
|
||||
|
||||
|
||||
mpd_bitrate
|
||||
@ -653,19 +663,19 @@ VARIABLES
|
||||
|
||||
|
||||
mpd_vol
|
||||
MPD's volume
|
||||
MPD’s volume
|
||||
|
||||
|
||||
mpd_elapsed
|
||||
Song's elapsed time
|
||||
Song’s elapsed time
|
||||
|
||||
|
||||
mpd_length
|
||||
Song's length
|
||||
Song’s length
|
||||
|
||||
|
||||
mpd_percent
|
||||
Percent of song's progress
|
||||
Percent of song’s progress
|
||||
|
||||
|
||||
mpd_random
|
||||
@ -758,7 +768,7 @@ VARIABLES
|
||||
|
||||
Examples:
|
||||
|
||||
${tcp_portmon 6881 6889 count} - displays the number of connec-
|
||||
${tcp_portmon 6881 6889 count} - displays the number of connec‐
|
||||
tions in the bittorrent port range
|
||||
|
||||
${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
|
||||
@ -777,7 +787,7 @@ VARIABLES
|
||||
name of the fifteenth connection in the range of all ports
|
||||
|
||||
Note that port monitor variables which share the same port range
|
||||
actually refer to the same monitor, so many references to a sin-
|
||||
actually refer to the same monitor, so many references to a sin‐
|
||||
gle port range for different items and different indexes all use
|
||||
the same monitor internally. In other words, the program avoids
|
||||
creating redundant monitors.
|
||||
@ -785,7 +795,7 @@ VARIABLES
|
||||
texeci interval command
|
||||
Runs a command at an interval inside a thread and displays the
|
||||
output. Same as $execi, except the command is run inside a
|
||||
thread. Use this if you have a slow script to keep Conky updat-
|
||||
thread. Use this if you have a slow script to keep Conky updat‐
|
||||
ing. You should make the interval slightly longer then the time
|
||||
it takes your script to execute. For example, if you have a
|
||||
script that take 5 seconds to execute, you should make the
|
||||
@ -798,18 +808,18 @@ VARIABLES
|
||||
|
||||
tail logfile lines (interval)
|
||||
Displays last N lines of supplied text text file. If interval is
|
||||
not supplied, Conky assumes 2x Conky's interval. Max of 30 lines
|
||||
not supplied, Conky assumes 2x Conky’s interval. Max of 30 lines
|
||||
can be displayed, or until the text buffer is filled.
|
||||
|
||||
|
||||
time (format)
|
||||
Local time, see man strftime to get more information about for-
|
||||
Local time, see man strftime to get more information about for‐
|
||||
mat
|
||||
|
||||
|
||||
totaldown net
|
||||
Total download, overflows at 4 GB on Linux with 32-bit arch and
|
||||
there doesn't seem to be a way to know how many times it has
|
||||
there doesn’t seem to be a way to know how many times it has
|
||||
already done that before conky has started.
|
||||
|
||||
|
||||
@ -872,7 +882,7 @@ VARIABLES
|
||||
|
||||
|
||||
EXAMPLES
|
||||
conky -t '${time %D %H:%m}' -o -u 30
|
||||
conky -t ’${time %D %H:%m}’ -o -u 30
|
||||
Start Conky in its own window with date and clock as text and 30
|
||||
sec update interval.
|
||||
|
||||
@ -883,9 +893,9 @@ FILES
|
||||
~/.conkyrc default configuration file
|
||||
|
||||
BUGS
|
||||
Drawing to root or some other desktop window directly doesn't work with
|
||||
all window managers. Especially doesn't work well with Gnome and it has
|
||||
been reported that it doesn't work with KDE either. Nautilus can be
|
||||
Drawing to root or some other desktop window directly doesn’t work with
|
||||
all window managers. Especially doesn’t work well with Gnome and it has
|
||||
been reported that it doesn’t work with KDE either. Nautilus can be
|
||||
disabled from drawing to desktop with program gconf-editor. Uncheck
|
||||
show_desktop in /apps/nautilus/preferences/. There is -w switch in
|
||||
Conky to set some specific window id. You might find xwininfo -tree
|
||||
@ -895,13 +905,13 @@ BUGS
|
||||
SEE ALSO
|
||||
http://conky.sourceforge.net [http://conky.sourceforge.net]
|
||||
|
||||
http://www.sourceforge.net/projects/conky [http://www.source-
|
||||
http://www.sourceforge.net/projects/conky [http://www.source‐
|
||||
forge.net/projects/conky]
|
||||
|
||||
#conky on irc.freenode.net
|
||||
|
||||
AUTHORS
|
||||
The Conky dev team. What's up now!
|
||||
The Conky dev team. What’s up now!
|
||||
|
||||
|
||||
|
||||
|
@ -278,6 +278,20 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>min_port_monitors</option></command></term>
|
||||
<listitem>
|
||||
Allow for the creation of at least this number of port monitors (if 0 or not set, default is 16)
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>min_port_monitor_connections</option></command></term>
|
||||
<listitem>
|
||||
Allow each port monitor to track at least this many connections (if 0 or not set, default is 256)
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>TEXT</option></command></term>
|
||||
<listitem>
|
||||
@ -285,4 +299,4 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</variablelist>
|
||||
|
@ -129,6 +129,12 @@ use_spacer no
|
||||
# boinc (seti) dir
|
||||
# seti_dir /opt/seti
|
||||
|
||||
# Allow for the creation of at least this number of port monitors (if 0 or not set, default is 16)
|
||||
#min_port_monitors 16
|
||||
|
||||
# Allow each port monitor to track at least this many connections (if 0 or not set, default is 256)
|
||||
#min_port_monitor_connections 256
|
||||
|
||||
# variable is given either in format $variable or in ${variable}. Latter
|
||||
# allows characters right after the variable and must be used in network
|
||||
# stuff because of an argument
|
||||
|
59
src/conky.c
59
src/conky.c
@ -258,6 +258,11 @@ int no_buffers;
|
||||
/* pad percentages to decimals? */
|
||||
static int pad_percents = 0;
|
||||
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
static int min_port_monitors = 0; /* config item */
|
||||
static int min_port_monitor_connections = 0; /* config item */
|
||||
#endif
|
||||
|
||||
/* Text that is shown */
|
||||
static char original_text[] =
|
||||
"$nodename - $sysname $kernel on $machine\n"
|
||||
@ -1821,7 +1826,18 @@ int a = stippled_borders, b = 1;
|
||||
/* if the port monitor collection hasn't been created, we must create it */
|
||||
if ( !info.p_tcp_port_monitor_collection )
|
||||
{
|
||||
info.p_tcp_port_monitor_collection = create_tcp_port_monitor_collection();
|
||||
double hash_size, log_base_2;
|
||||
|
||||
/* calculate hash_size from min_port_monitors */
|
||||
hash_size = (double)min_port_monitors / (double)TCP_MONITOR_HASH_MAX_LOAD_PCT;
|
||||
/* correct hash_size to nearest power of two */
|
||||
log_base_2 = log(hash_size) / log(2);
|
||||
if ( log_base_2 - (int)log_base_2 > 0.001 )
|
||||
log_base_2 = (double)( (int)log_base_2 + 1 );
|
||||
hash_size = pow(2,log_base_2);
|
||||
/*fprintf(stderr,"collection hash size is %d\n",(int)hash_size);*/
|
||||
|
||||
info.p_tcp_port_monitor_collection = create_tcp_port_monitor_collection( (int)hash_size );
|
||||
if ( !info.p_tcp_port_monitor_collection )
|
||||
{
|
||||
CRIT_ERR("tcp_portmon: unable to create port monitor collection");
|
||||
@ -1831,7 +1847,19 @@ int a = stippled_borders, b = 1;
|
||||
/* if a port monitor for this port does not exist, create one and add it to the collection */
|
||||
if ( find_tcp_port_monitor( info.p_tcp_port_monitor_collection, port_begin, port_end ) == NULL )
|
||||
{
|
||||
tcp_port_monitor_t * p_monitor = create_tcp_port_monitor( port_begin, port_end );
|
||||
double hash_size, log_base_2;
|
||||
|
||||
/* calculate hash_size from min_port_monitor_connections */
|
||||
hash_size = (double)min_port_monitor_connections / (double)TCP_CONNECTION_HASH_MAX_LOAD_PCT;
|
||||
/* correct hash_size to nearest power of two */
|
||||
log_base_2 = log(hash_size) / log(2);
|
||||
if ( log_base_2 - (int)log_base_2 > 0.001)
|
||||
log_base_2 = (double)( (int)log_base_2 + 1 );
|
||||
hash_size = pow(2, log_base_2);
|
||||
/*fprintf(stderr,"monitor hash size is %d\n",(int)hash_size);*/
|
||||
|
||||
tcp_port_monitor_t * p_monitor =
|
||||
create_tcp_port_monitor( port_begin, port_end, (int)hash_size );
|
||||
if ( !p_monitor )
|
||||
{
|
||||
CRIT_ERR("tcp_portmon: unable to create port monitor");
|
||||
@ -4477,6 +4505,11 @@ static void set_default_configurations(void)
|
||||
mlconfig.mldonkey_login = NULL;
|
||||
mlconfig.mldonkey_password = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
min_port_monitors = MIN_PORT_MONITORS_DEFAULT;
|
||||
min_port_monitor_connections = MIN_PORT_MONITOR_CONNECTIONS_DEFAULT;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void load_config_file(const char *f)
|
||||
@ -4882,6 +4915,28 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
CONF("min_port_monitors")
|
||||
{
|
||||
if ( !value ||
|
||||
(sscanf(value, "%d", &min_port_monitors) != 1) ||
|
||||
min_port_monitors <= 0 )
|
||||
{
|
||||
min_port_monitors = MIN_PORT_MONITORS_DEFAULT;
|
||||
CONF_ERR;
|
||||
}
|
||||
}
|
||||
CONF("min_port_monitor_connections")
|
||||
{
|
||||
if ( !value ||
|
||||
(sscanf(value, "%d", &min_port_monitor_connections) != 1)
|
||||
|| min_port_monitor_connections <= 0 )
|
||||
{
|
||||
min_port_monitor_connections = MIN_PORT_MONITOR_CONNECTIONS_DEFAULT;
|
||||
CONF_ERR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
ERR("%s: %d: no such configuration: '%s'", f, line, name);
|
||||
|
||||
|
@ -114,7 +114,10 @@ struct mpd_s {
|
||||
#endif
|
||||
|
||||
#ifdef TCP_PORT_MONITOR
|
||||
#include <math.h>
|
||||
#include "libtcp-portmon.h"
|
||||
#define MIN_PORT_MONITORS_DEFAULT 16
|
||||
#define MIN_PORT_MONITOR_CONNECTIONS_DEFAULT 256
|
||||
#endif
|
||||
|
||||
enum {
|
||||
|
@ -513,7 +513,8 @@ void for_each_tcp_port_monitor_in_collection(
|
||||
so that there are no redundant monitors. */
|
||||
tcp_port_monitor_t * create_tcp_port_monitor(
|
||||
in_port_t port_range_begin,
|
||||
in_port_t port_range_end
|
||||
in_port_t port_range_end,
|
||||
int hash_size
|
||||
)
|
||||
{
|
||||
tcp_port_monitor_t * p_monitor;
|
||||
@ -524,7 +525,8 @@ tcp_port_monitor_t * create_tcp_port_monitor(
|
||||
return NULL;
|
||||
|
||||
/* create the monitor's connection hash */
|
||||
if ( hash_create( &p_monitor->hash, TCP_CONNECTION_HASH_SIZE,
|
||||
if ( hash_create( &p_monitor->hash,
|
||||
hash_size > 0 ? hash_size : TCP_CONNECTION_HASH_SIZE,
|
||||
&connection_hash_function_1, &connection_hash_function_2,
|
||||
&connection_match_function, NULL ) != 0 )
|
||||
{
|
||||
@ -655,7 +657,9 @@ int peek_tcp_port_monitor(
|
||||
* -------------------------------- */
|
||||
|
||||
/* Create a monitor collection. Do this one first. */
|
||||
tcp_port_monitor_collection_t * create_tcp_port_monitor_collection( void )
|
||||
tcp_port_monitor_collection_t * create_tcp_port_monitor_collection(
|
||||
int hash_size
|
||||
)
|
||||
{
|
||||
tcp_port_monitor_collection_t * p_collection;
|
||||
|
||||
@ -664,7 +668,8 @@ tcp_port_monitor_collection_t * create_tcp_port_monitor_collection( void )
|
||||
return NULL;
|
||||
|
||||
/* create the collection's monitor hash */
|
||||
if ( hash_create( &p_collection->hash, TCP_MONITOR_HASH_SIZE,
|
||||
if ( hash_create( &p_collection->hash,
|
||||
hash_size > 0 ? hash_size : TCP_MONITOR_HASH_SIZE,
|
||||
&monitor_hash_function_1, &monitor_hash_function_2,
|
||||
&monitor_match_function, NULL ) != 0 )
|
||||
{
|
||||
|
@ -51,7 +51,7 @@
|
||||
* at an average access time of O(1).
|
||||
* ------------------------------------------------------------------------------------------------*/
|
||||
|
||||
#define TCP_CONNECTION_HASH_SIZE 256 /* connection hash size -- must be a power of two */
|
||||
#define TCP_CONNECTION_HASH_SIZE 512 /* connection hash size -- must be a power of two */
|
||||
#define TCP_CONNECTION_HASH_MAX_LOAD_PCT 0.5 /* disallow inserts after this % load is exceeded */
|
||||
#define TCP_CONNECIION_HASH_MAX_VACATED_PCT 0.25 /* rebalance hash after this % of vacated slots is exceeded */
|
||||
#define TCP_CONNECIION_STARTING_AGE 1 /* connection deleted if unseen again after this # of refreshes */
|
||||
@ -66,9 +66,8 @@
|
||||
* lookups at O(1).
|
||||
* ----------------------------------------------------------------------------------------*/
|
||||
|
||||
/* TODO: Make TCP_CONNECTION_HASH_SIZE and TCP_MONITOR_HASH_SIZE variables the client can supply */
|
||||
|
||||
#define TCP_MONITOR_HASH_SIZE 64 /* monitor hash size -- must be a power of two */
|
||||
#define TCP_MONITOR_HASH_SIZE 32 /* monitor hash size -- must be a power of two */
|
||||
#define TCP_MONITOR_HASH_MAX_LOAD_PCT 0.5 /* disallow new monitors after this % load is exceeded */
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
* IMPLEMENTATION INTERFACE
|
||||
@ -233,7 +232,8 @@ void for_each_tcp_port_monitor_in_collection(
|
||||
so that there are no redundant monitors. */
|
||||
tcp_port_monitor_t * create_tcp_port_monitor(
|
||||
in_port_t /* port_range_begin */,
|
||||
in_port_t /* port_range_end */
|
||||
in_port_t /* port_range_end */,
|
||||
int /* hash_size */
|
||||
);
|
||||
|
||||
/* Clients use this function to get connection data from the indicated port monitor.
|
||||
@ -252,7 +252,9 @@ int peek_tcp_port_monitor(
|
||||
* -------------------------------- */
|
||||
|
||||
/* Create a monitor collection. Do this one first. */
|
||||
tcp_port_monitor_collection_t * create_tcp_port_monitor_collection( void );
|
||||
tcp_port_monitor_collection_t * create_tcp_port_monitor_collection(
|
||||
int /* hash_size */
|
||||
);
|
||||
|
||||
/* Destroy the monitor collection (and everything it contains). Do this one last. */
|
||||
void destroy_tcp_port_monitor_collection(
|
||||
|
Loading…
Reference in New Issue
Block a user