Skip to content

Commit fcce3ae

Browse files
author
drscholl
committed
added stats reporting for total bytes sent/received
server_usage() now reports searches/sec and total bytes in/out
1 parent dc454d0 commit fcce3ae

File tree

7 files changed

+142
-3
lines changed

7 files changed

+142
-3
lines changed

ChangeLog

+116
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,119 @@
1+
2000-07-28 drscholl <[email protected]>
2+
3+
* browse.c: reverted previous changes
4+
5+
* add_file.c, download.c, init.c, main.c, opennap.h, remove_file.c, search.c, upload_complete.c, util.c:
6+
reverted back to storing full pathnames in the DATUM struct. it was causing
7+
too much load having to regenerate the filename every time match() needed to
8+
be called.
9+
10+
* config.c, join.c, main.c, opennap.h, search.c, server_usage.c:
11+
added `search_timeout' variable to set the expiration time of remote
12+
searches (default: 180 secs)
13+
14+
bytes in/out was not time averaged in server_usage()
15+
16+
* channel.c, free_user.c, login.c, main.c, opennap.h, remove_connection.c, synch.c:
17+
cache the server names so that each USER struct can reference it a single
18+
time instead of once for each user
19+
20+
* configure, configure.in:
21+
fixed bug in configure which causes DEBUG to always be set
22+
23+
* download.c, upload_complete.c:
24+
reorganized code in download() to lookup the user's file only once
25+
26+
* TODO, add_file.c, download.c, opennap.h, remove_file.c, search.c, upload_complete.c, util.c:
27+
added more strict checking to make sure the directory name also matches when
28+
looking up a file by its basename
29+
30+
* browse.c, download.c, opennap.h, remove_file.c, upload_complete.c, util.c, add_file.c:
31+
modified hash table of user's files to index by only the pathname instead of
32+
the full directory name since that is no longer available
33+
34+
* add_file.c, browse.c, download.c, resume.c:
35+
fixed many other places where the full filename was not returned
36+
37+
* search.c:
38+
search did not return the full pathname of the shared files
39+
40+
* add_file.c, browse.c, init.c, main.c, opennap.h, search.c, TODO:
41+
created new hash table `Paths' for storing the directory components of
42+
shared files a single time for all files in the same directory.
43+
44+
2000-07-27 drscholl <[email protected]>
45+
46+
* channel.c, sample.channels:
47+
altered channels file so that # is no longer considered a comment in
48+
`version 1' files.
49+
50+
* NEWS, join.c, login.c:
51+
channel names must now begin with # or &. join will automatically prepend a
52+
hash (#) if missing
53+
54+
* configure, configure.in:
55+
debugging is no longer enabled by default. use `configure --enable-debug'
56+
to turn it on
57+
58+
* add_file.c, main.c, opennap.h:
59+
change Num_Gigs to a double. unsigned int was running out at 4096 GB.
60+
61+
* Makefile.am, Makefile.in, NEWS, README, ban.c, channel.c, configure, configure.in, download.c, glob.c, join.c, list_users.c, login.c, napster.txt, opennap.h, resume.c, search.c, synch.c, upload_complete.c, util.c, whois.c:
62+
imported changes from adns branch, without adns support
63+
64+
* NEWS, join.c:
65+
fixed bug in channel rollover code causing an infinite loop
66+
67+
2000-07-26 drscholl <[email protected]>
68+
69+
* channel.c:
70+
fixed bug which prevented registered channels from being dropped
71+
72+
* remove_connection.c:
73+
check to make sure con->dns != 0 before calling adns_cancel()
74+
75+
* upload_complete.c:
76+
fixed bug with downloads not working. forgot to switch .host to .ip
77+
in the download responses
78+
79+
2000-07-25 drscholl <[email protected]>
80+
81+
* main.c:
82+
added adns_if_noserverwarn to adns_init() to turn off warnings
83+
84+
* login.c, main.c:
85+
login() did not convert the uint32 ip address to dot-quad before using it
86+
as the host name
87+
88+
* server_connect.c:
89+
.resolved should be set when making an outgoing server connection so the
90+
connection doesnt time out waiting for a nonexistent dns lookup
91+
92+
* configure, configure.in:
93+
configure should use `if test' rather than `if ['
94+
95+
* README, list_users.c, whois.c:
96+
added the client ip address in dot-quad format to the end of the global user
97+
list response, and the whois response
98+
99+
* configure, configure.in:
100+
configure should look for -ladns in /usr/local/lib as well
101+
102+
* glob.c: New file.
103+
104+
* glob.c: forgot to add glob.c
105+
106+
* Makefile.am, Makefile.in, NEWS, ban.c, channel.c, configure, configure.in, download.c, join.c, list_users.c, login.c, main.c, napster.txt, opennap.h, remove_connection.c, resume.c, search.c, synch.c, whois.c:
107+
added initial support for adns to add reverse dns lookups for client
108+
connections.
109+
110+
2000-07-23 drscholl <[email protected]>
111+
112+
* ChangeLog, Makefile.in, README, configure, setup.c:
113+
fixed setup.c to compile under win32
114+
115+
updated ChangeLog with recent CVS log entries.
116+
1117
2000-07-20 drscholl <[email protected]>
2118

3119
* login.c:

NEWS

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ Removed the USER_IP server numeric. This version of opennap will not
1313
interoperate with other opennap servers < 0.33, but will use less
1414
bandwidth for server->server links
1515

16+
Added new config variable `search_timeout' which controls how long pending
17+
searches will be considered valid before timing out.
18+
19+
Added new config variable `stats_port' to make the port 8889 stats
20+
configurable since napigator now supports alternate ports.
21+
1622
[opennap 0.35]
1723

1824
added `max_clones' configuration variable to control how many clients may

config.c

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ static struct config Vars[] = {
7474
{"max_reason",VAR_TYPE_INT,UL&Max_Reason,64},
7575
{"max_clones",VAR_TYPE_INT,UL&Max_Clones,0},
7676
{"search_timeout",VAR_TYPE_INT,UL&Search_Timeout,180},
77+
{"stats_port",VAR_TYPE_INT,UL&Stats_Port,8889},
7778
};
7879

7980
static int Vars_Size = sizeof (Vars) / sizeof (struct config);

main.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int Max_User_Channels; /* default, can be changed in config */
3636
int Stat_Click; /* interval (in seconds) to send server stats */
3737
LIST *Server_Ports = 0; /* which port(s) to listen on for connections */
3838
int Server_Queue_Length;
39+
int Stats_Port; /* port to listen on for stats info */
3940
int Client_Queue_Length;
4041
int Max_Search_Results;
4142
int Max_Shared;
@@ -59,6 +60,8 @@ int Max_Client_String;
5960
int Max_Reason;
6061
int Max_Clones;
6162
int Search_Timeout;
63+
unsigned int Total_Bytes_In = 0; /* bytes received */
64+
unsigned int Total_Bytes_Out = 0; /* bytes sent */
6265

6366
#ifndef WIN32
6467
int Uid;
@@ -133,6 +136,10 @@ update_stats (void)
133136
log ("update_stats(): %d channels", Channels->dbsize);
134137
log ("update_stats(): %.2f kbytes/sec in, %.2f kbytes/sec out",
135138
(float) Bytes_In / 1024. / delta, (float) Bytes_Out / 1024. / delta);
139+
Total_Bytes_In += Bytes_In;
140+
Total_Bytes_Out += Bytes_Out;
141+
log ("update_stats(): %u bytes sent, %u bytes received",
142+
Total_Bytes_Out, Total_Bytes_In);
136143

137144
/* reset counters */
138145
Bytes_In = 0;
@@ -437,7 +444,7 @@ main (int argc, char **argv)
437444
/* listen on port 8889 for stats reporting */
438445
if ((sp = new_tcp_socket (ON_REUSEADDR)) == -1)
439446
exit (1);
440-
if (bind_interface (sp, Interface, 8889))
447+
if (bind_interface (sp, Interface, Stats_Port))
441448
exit (1);
442449
if (listen (sp, BACKLOG))
443450
{

opennap.h

+3
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,10 @@ extern LIST *Server_Ports;
379379
extern int Server_Queue_Length;
380380
extern int SigCaught; /* flag to control main loop */
381381
extern int Stat_Click;
382+
extern int Stats_Port;
382383
extern time_t Server_Start;
384+
extern unsigned int Total_Bytes_In;
385+
extern unsigned int Total_Bytes_Out;
383386
extern int User_Db_Interval;
384387
extern int Max_Channel_Length;
385388
extern int Max_Ignore;

sample.conf

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ server_password opensource
9696
# maximum number of connnections from a single ip (default: 0 [unlimited])
9797
#max_clones 3
9898

99+
# port to listen on for stats reporting (useful to napigator)
100+
#stats_port 8889
101+
99102
# END of Win32 configuration. What follows is only for the Unix versions
100103

101104
# if your operating system has a small limit for the maxium amount of data

server_usage.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ HANDLER (server_usage)
3333

3434
numServers = list_count (Servers);
3535
send_user (user, MSG_SERVER_USAGE_STATS,
36-
"%d %d %d %d %.0f %d %d %d %d %d %.2f %.2f",
36+
"%d %d %d %d %.0f %d %d %d %d %d %.2f %.2f %.2f %u %u",
3737
Num_Clients - numServers,
3838
numServers,
3939
Users->dbsize,
@@ -45,7 +45,10 @@ HANDLER (server_usage)
4545
mem_used,
4646
User_Db->dbsize,
4747
(float) Bytes_In / 1024. / delta,
48-
(float) Bytes_Out / 1024. / delta);
48+
(float) Bytes_Out / 1024. / delta,
49+
(float) Search_Count / delta,
50+
Total_Bytes_In,
51+
Total_Bytes_Out);
4952
}
5053
else
5154
pass_message_args (con, tag, ":%s %s", user->nick, pkt);

0 commit comments

Comments
 (0)