Commit Graph

497 Commits

Author SHA1 Message Date
Jan Vidar Krey
f176e790e2 Whitespace fixes. 2009-07-26 01:53:01 +02:00
Jan Vidar Krey
367871e476 Renamed all "struct user" to hub_user in order to resolve a naming conflict on OpenWRT.
Basically: sed -i 's/struct user/struct hub_user/g' `find -type f`
2009-07-26 01:47:17 +02:00
Jan Vidar Krey
2ac5cc19cb Removed plugin.h, not in use. 2009-07-26 01:39:16 +02:00
Jan Vidar Krey
6e5d28c2d4 Rework logging code to be able to turn it off completely. 2009-07-26 01:38:38 +02:00
Jan Vidar Krey
5048ff9ae5 Whitespace fixes. 2009-07-26 00:58:25 +02:00
Jan Vidar Krey
36a07e3f7e Reorganized sources slightly. 2009-07-25 20:05:27 +02:00
Jan Vidar Krey
e281f61472 Add support for better pipelining of commands, in order to reduce the number of send() calls. 2009-07-25 03:54:59 +02:00
Jan Vidar Krey
bb27ff617c Re-fix chat_is_privileged. 2009-07-25 03:33:36 +02:00
Jan Vidar Krey
dc90245ade No need to store event mask in the user object since libevent already does it for us. 2009-07-25 03:26:59 +02:00
Jan Vidar Krey
0ec4913e15 Debug for send queue fix. 2009-07-25 03:24:06 +02:00
Jan Vidar Krey
61d639bfa2 Fix to hub_sendq_is_empty in order to prevent event_add calls. 2009-07-25 03:23:06 +02:00
Jan Vidar Krey
adeaf23f9c Kept spinning in send() 2009-07-19 14:45:15 +02:00
Jan Vidar Krey
03d3ffd20f Fix socket error due to EWOULDBLOCK. 2009-07-19 14:29:33 +02:00
Jan Vidar Krey
bbae2603b0 Make sure we detect send errors. 2009-07-19 03:39:11 +02:00
Jan Vidar Krey
5f0c84f46a Fix shutdown problem and reduce event_{add,del,set} calls. 2009-07-19 03:12:47 +02:00
Jan Vidar Krey
b02618d19c Bad mistake - never added message to send queue. 2009-07-19 02:46:01 +02:00
Jan Vidar Krey
927faf70fc Re-enabled send queue fixes. This will more aggressively prevent unimportant messages (like searches) to be forwarded to slow clients that cannot swallow what is sent to it. This should reduce memory usage somewhat on really large hubs. 2009-07-19 02:31:23 +02:00
Jan Vidar Krey
4a173bf066 Fix some nasty bugs related to read/write events and timeout events.
This would have caused users not being able to log in, and in some cases
100% cpu usage.
2009-07-19 02:12:50 +02:00
Jan Vidar Krey
abd097acf0 This is a somewhat risky patch, but it has been intended for quite some time:
Remove the libevent handler for write events, only use one common event handler for both reading and writing.
2009-07-09 17:03:31 +02:00
Jan Vidar Krey
3db2ec5e22 Added macros that can possibly make it easier to optimize functions using forced inlining and regparm. 2009-07-09 17:01:30 +02:00
Jan Vidar Krey
e68cbd0cde Minor cleanups of old authentication stuff, and some documentation. 2009-07-03 01:29:04 +02:00
Jan Vidar Krey
98bffd93e9 Fix stupid crash on empty command. 2009-07-01 11:31:55 +02:00
Jan Vidar Krey
e53119e92c Server did not answer due to wrong checks. 2009-07-01 09:50:46 +02:00
Jan Vidar Krey
ee0ea5a427 Crash fix. 2009-06-30 22:15:08 +02:00
Jan Vidar Krey
aa7be1dc4b Fix a command parse error output problem, plus some minor cleaning up. 2009-06-30 11:48:58 +02:00
Jan Vidar Krey
0ef248759c Minor cleanups.
Enabled !crash command if compiled with debug (not release).
2009-06-29 23:22:13 +02:00
Jan Vidar Krey
1f7f6a43f9 Fixed small memory leak. 2009-06-26 01:16:07 +02:00
Jan Vidar Krey
3cf005a08e Fixed command parsing for in hub user commands.
Added a framework for automatic syntax checks, and correct number
of arguments to commands.
2009-06-26 01:15:06 +02:00
Jan Vidar Krey
f3c5fced47 Documentation 2009-06-25 22:05:40 +02:00
Jan Vidar Krey
9c49f07826 Fixed the format of the git revision.
Removed the product title.
2009-06-25 22:04:48 +02:00
Jan Vidar Krey
5f3f2d4f4d Autotest crash fix. 2009-06-25 17:31:39 +02:00
Jan Vidar Krey
7e3a26b0f3 Winsock fixes for shutdown() - typo 2009-06-25 17:07:21 +02:00
Jan Vidar Krey
9ebb38ae15 Winsock fixes for shutdown() 2009-06-25 17:05:59 +02:00
Jan Vidar Krey
75c4272a1b Fix problem with the !stats byte counter. 2009-06-25 09:29:23 +02:00
Jan Vidar Krey
ddba669af0 Some basic work on getting bans working.
Basically now it can ban a user (nick + cid), it will be added to the
ban list temporarily, and will not be enabled if you restart the hub.
A banned user will automatically be kicked.

unban does not work correctly.
2009-06-23 23:16:09 +02:00
Jan Vidar Krey
ca33461851 Suppress send() or recv() errors from logs. They happen quite often and are not considered errors. 2009-06-23 01:57:55 +02:00
Jan Vidar Krey
4abdc3edbd Cleanup read/write socket handling somewhat. 2009-06-23 01:57:26 +02:00
Jan Vidar Krey
90078ad4b6 Minor cleanups and some work to prepare SSL. 2009-06-23 01:56:37 +02:00
Jan Vidar Krey
3bd5c36455 SSL work. 2009-06-23 01:09:55 +02:00
Jan Vidar Krey
8f0943621e Dont set socket buffers. 2009-06-22 21:13:41 +02:00
Jan Vidar Krey
155350b61b Fixed crash bug #33 2009-06-22 21:05:02 +02:00
Jan Vidar Krey
1c58120c03 Oportunistic write. 2009-06-22 20:25:22 +02:00
Jan Vidar Krey
1d9acece34 Ensure we set a max recv and send buffer per user, and that it does not
exceed the one used internally by the application.
2009-06-22 19:50:10 +02:00
Jan Vidar Krey
57fd872f14 Added a state check for protocol negotiation.
Will be used to negotiate SSL.
2009-06-22 19:38:24 +02:00
Jan Vidar Krey
ca7544df9b Cleanups. 2009-06-22 19:37:56 +02:00
Jan Vidar Krey
c7777e2624 Added functions:
* net_get_recvbuf_size
* net_set_recvbuf_size
* net_get_sendbuf_size
* net_set_sendbuf_size

Did some minor cleanups.
2009-06-22 19:36:55 +02:00
Jan Vidar Krey
b2d543d433 Started work on SSL 2009-06-22 18:44:07 +02:00
Jan Vidar Krey
ff47281197 Added a generic way to reset last read/write variables. 2009-06-22 18:38:39 +02:00
Jan Vidar Krey
ddc91d1640 Make sure we close stdout, stdin and stderr after forking to background in order to properly detach from the TTY. 2009-06-22 18:36:48 +02:00
Jan Vidar Krey
e6e26a02e7 Added a known crash for the admin only to use if compiled with CRASH_DEBUG enabled. 2009-06-22 01:18:51 +02:00
Jan Vidar Krey
ea3cd1bd90 Work on optimizing send(), to use fewer send function calls. 2009-06-21 14:21:34 +02:00
Jan Vidar Krey
7f24238ab5 Disable sendq debugging. 2009-06-20 22:46:11 +02:00
Jan Vidar Krey
1d2d4e74f6 !stats did not work. 2009-06-18 01:46:17 +02:00
root
5250fdaf57 Fix bug #38 - Pid file support. 2009-06-17 12:52:49 +02:00
Jan Vidar Krey
513ab422f2 Compile fix. 2009-06-01 14:34:23 +02:00
Jan Vidar Krey
0eb91763fa Potential crash fix. 2009-06-01 01:52:57 +02:00
Jan Vidar Krey
507f429035 Fix send queue issue. 2009-05-28 23:44:28 +02:00
Jan Vidar Krey
b1ab64242e Renamed a function. 2009-05-28 01:48:31 +02:00
Jan Vidar Krey
8b90f79bac Work in progress on optimizing the send() function calls, to use as few as possible.
(Although, this does not enable that code).
2009-05-28 01:47:48 +02:00
Jan Vidar Krey
8f7cc0b7a7 Fixed MAX and MIN macros. 2009-05-28 01:45:36 +02:00
Jan Vidar Krey
860310caff Massive restructuring. 2009-05-26 21:05:06 +02:00
Jan Vidar Krey
8167d79f5a Large reorganizations of the code base. 2009-05-26 19:46:51 +02:00
Jan Vidar Krey
9706a0a501 Fix compiler warning (bug #30) 2009-05-24 21:07:16 +02:00
Jan Vidar Krey
9309c925d3 Started working on new pipelines for sending and receiving data.
This will be useful for the next step; SSL.

(NOTE: This code is very chatty about debug messages)
2009-05-19 22:57:50 +02:00
Jan Vidar Krey
9a3a5bc2de Make sure the send() signature is correct, buf should be const. 2009-05-19 22:36:45 +02:00
Jan Vidar Krey
e382e24337 Fix crash due to user->hub deref in acl handling. 2009-05-19 16:40:14 +02:00
Jan Vidar Krey
be4ff1d8cc Fix command parsing for in-hub commands. 2009-05-19 11:22:57 +02:00
Jan Vidar Krey
aa18ac047d Crash fix 2009-05-19 09:38:57 +02:00
Jan Vidar Krey
e120d5c76d Minor cleanup - this code crashes. 2009-05-19 09:15:14 +02:00
Jan Vidar Krey
6853e92f89 Move user_is_protected() and user_is_registered() into user.h/.c 2009-05-18 17:52:30 +02:00
Jan Vidar Krey
1dbf2640d2 More API fixes; remove implicit relationship between hub and user
in APIs.
2009-05-18 16:30:17 +02:00
Jan Vidar Krey
caec28f63f Warn on bad UTF-8 in the configuration file. 2009-05-16 12:48:17 +02:00
Jan Vidar Krey
5ea5efb875 Smome user manager functions did not have the uman_ prefix. 2009-05-16 12:42:30 +02:00
Jan Vidar Krey
326fcc467c Moved the update_user_info code into user_update_info 2009-05-16 12:32:48 +02:00
Jan Vidar Krey
078470ce64 Minor cleanup 2009-05-16 12:25:28 +02:00
Jan Vidar Krey
82ac450b4b Fixed further memory leaks in autotests. 2009-05-16 04:03:00 +02:00
Jan Vidar Krey
b4f24b21f9 Document bandwidth optimization potential. 2009-05-16 03:45:05 +02:00
Jan Vidar Krey
548867de10 Removed ADC_UDP_OPERATION code as it is not used or needed. on_kick is also gone. 2009-05-16 03:14:20 +02:00
Jan Vidar Krey
953db2dcbc Fixed some autotest memory leaks. 2009-05-16 03:06:14 +02:00
Jan Vidar Krey
604364ffa5 Fixed various code deprecations
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-05-15 18:45:26 +02:00
Jan Vidar Krey
6cc1af5671 Disable code to prevent warnings. 2009-05-15 16:52:55 +02:00
Jan Vidar Krey
15e2053699 Fix #28 - Request: +/! characters for command handling (FleetCommand) 2009-05-15 16:52:04 +02:00
Jan Vidar Krey
df1e832a3c Started working on a red-black tree implementation, need to speed up
certain operations, such as SID to user lookups, and nick to user.
2009-05-01 17:07:38 +02:00
Jan Vidar Krey
4c4cb4fb36 Dont allow clients that do not support BASE
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-04-13 05:31:41 +02:00
Jan Vidar Krey
e49f9d4d30 Added kick support
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-04-09 00:48:00 +02:00
Jan Vidar Krey
e73a931243 Ensure we do not allow update of certain elements.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-27 11:12:50 +01:00
Jan Vidar Krey
ae017af758 Log version and method of libevent()
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-24 23:32:39 +01:00
Jan Vidar Krey
26f1864c1f Don't crash if one specify '-S' or '-s' and an invalid configuration file. 2009-03-24 23:10:51 +01:00
Jan Vidar Krey
c14fa3c3a9 Added more debugging info for mainloop bug #16 - In addition to small fixes to it.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-24 22:06:26 +01:00
Jan Vidar Krey
8af965c0ca Fixed utf8 parse issue.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-24 00:21:38 +01:00
Jan Vidar Krey
3a270564d2 Fixed up admin scripts.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-23 22:36:45 +01:00
Jan Vidar Krey
7aeb8651ba Fix bug #12: asserts in adc_msg_parse -> enabled strict utf8 parsing.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-23 21:47:05 +01:00
Jan Vidar Krey
13a8700554 Make sure logs do not output configured messages, but rather code names.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-23 15:47:54 +01:00
Jan Vidar Krey
5d5dda2f9b Always obtain IP address during accept(), and not do it later as a call to getsockname().
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-23 15:05:27 +01:00
Jan Vidar Krey
90abf64e3a Do explicit logging in src/message.c 2009-03-23 08:18:25 +01:00
Jan Vidar Krey
e9915df87c remove timezone from logs, as it screws up on windows.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-21 04:11:14 +01:00
Jan Vidar Krey
1a1b5bdb38 Fixed nasty crash if a user sends a very large command to the hub.
Will overwrite heap memory.
Thanks to Toast who found this bug.

Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-21 02:58:53 +01:00
Jan Vidar Krey
7738baf38e Log configuration reloads.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 19:09:55 +01:00
Jan Vidar Krey
3c4c52d0f9 Log configuration reloads.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 19:08:24 +01:00
Jan Vidar Krey
76588fb1bd Don't print OK or ERROR when dumping config.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 19:05:25 +01:00
Jan Vidar Krey
f9e95ec582 Minor cleanups
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 19:02:32 +01:00
Jan Vidar Krey
7985d4fed0 Cleanup credentials to string handling
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 18:54:05 +01:00
Jan Vidar Krey
77343d3c21 Remove duplicate access_denied checks.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 18:38:42 +01:00
Jan Vidar Krey
f8d5b72a89 Cleanup command list, automatically generate help list depending on user credentials. 2009-03-20 18:37:38 +01:00
Jan Vidar Krey
cf2994b570 Fix whitespace 2009-03-20 18:37:05 +01:00
Jan Vidar Krey
b1f84b5b4a Cleanup logging.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 17:40:50 +01:00
Jan Vidar Krey
998c6c36ce Fix indentation 2009-03-20 16:40:59 +01:00
Jan Vidar Krey
4112b8111a Fix problems with clients sending multiple INF messages during the login stage. Only the first one will be checked. 2009-03-20 16:40:34 +01:00
Jan Vidar Krey
1929f2fae7 Fix bug #9 - net_get_peer_address() failure on CentOS/Xen configurations.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-20 15:07:52 +01:00
Jan Vidar Krey
0266c8bb9c Libevent fixes, and memory leak fix.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-19 17:57:04 +01:00
Jan Vidar Krey
5e3eabb677 Fix help message typo
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-19 01:30:46 +01:00
Jan Vidar Krey
669ab14022 Minor cleanups and stack reduction.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-19 01:27:34 +01:00
Jan Vidar Krey
1d491055c5 Do not use event_loopexit with new event loop.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-19 01:13:02 +01:00
Jan Vidar Krey
08351ea8e7 Merge branch 'event_queue_work' 2009-03-19 01:08:57 +01:00
Jan Vidar Krey
e2ac690164 Reindented code. 2009-03-19 01:01:36 +01:00
Jan Vidar Krey
3bb563b432 Cleaned up command system somewhat. Added admin commands for reload and shutdown. 2009-03-19 00:55:11 +01:00
Jan Vidar Krey
e10582fec2 Cleaned up command system slightly.
Added admin commands for reload and shutdown.
2009-03-19 00:53:44 +01:00
Jan Vidar Krey
84e278658b Libevent changes. 2009-03-19 00:43:43 +01:00
Jan Vidar Krey
c671851be8 Cleaned up local event queue.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-18 02:56:49 +01:00
Jan Vidar Krey
4f8edfe9c8 Started working on an updated libevent and event queue implementation that would not require timers.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-18 02:32:00 +01:00
Jan Vidar Krey
b8a0b45245 Dump configuration does not quote integer and boolean settings.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-16 14:40:17 +01:00
Jan Vidar Krey
1e6f0a392a Don't produce errors if a user is already logged in and trying again. 2009-03-16 12:46:29 +01:00
Jan Vidar Krey
f396902c57 Do not use socket call to print IP address when we do have a cached representation. 2009-03-16 12:45:13 +01:00
Jan Vidar Krey
acc697c33a Do not use socket call to print IP address when we do have a cached representation. 2009-03-16 12:43:45 +01:00
Jan Vidar Krey
c29815ed62 Fixed compile warning. 2009-03-16 12:40:12 +01:00
Jan Vidar Krey
e74d2be318 Be more explicit when queueing.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-16 12:33:10 +01:00
Jan Vidar Krey
58e2982675 Fixed bug #1: Excessive send queue bug (corruption of the offset variable).
Low priority messages are not relayed if soft limit send queue is reached.

Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-16 12:28:58 +01:00
Jan Vidar Krey
4797d5ee90 SendQ debugging
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-14 02:09:45 +01:00
Jan Vidar Krey
5a0f01d1ec Don't assert, rather print error messages.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 17:07:06 +01:00
Jan Vidar Krey
f6af8cf389 Merged changes from github.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 16:54:39 +01:00
Jan Vidar Krey
7337d9e1d1 Ensure the send queue offset is calculated correctly in case of a partial queued write.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 16:51:27 +01:00
Jan Vidar Krey
5a978d361c Added asserts in case send queue size goes below zero.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 01:29:21 +01:00
Jan Vidar Krey
62d489130c Dont do double I4/I6 records.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 01:10:13 +01:00
Jan Vidar Krey
3aecd67134 Re-fix #5: Always provide IP-address to all users, not just for active clients.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-13 00:54:37 +01:00
Jan Vidar Krey
a3520fbf09 Always provide IP address to all clients.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-12 16:24:44 +01:00
Jan Vidar Krey
18b0dc713f Better dynamic send queue handling for large hubs at the cost of more memory use.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-12 16:00:56 +01:00
Jan Vidar Krey
6cf6e38a60 Document config default variables correctly. 2009-03-12 16:00:31 +01:00
Jan Vidar Krey
9770eaf559 Ensure admins and super users are also listed as operators
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-10 11:13:26 +01:00
Jan Vidar Krey
fcd532fd4b Wrong stats, peak rx never calculated.
Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
2009-03-10 00:17:49 +01:00
Jan Vidar Krey
dd5986c05f Better help message formatting. 2009-03-08 22:17:41 +01:00
Jan Vidar Krey
990fc31296 Added +myip command. 2009-03-08 17:11:10 +01:00
Jan Vidar Krey
6511761991 Fixed uptime output formatting to be less verbose. 2009-03-06 00:46:45 +01:00
Jan Vidar Krey
c02c45f2d0 Escalate user_disconnect to an error in case of a "ghost login". I want to see them in logs. 2009-03-04 18:44:53 +01:00
Jan Vidar Krey
d4c8b657bf Better "!stats"; can display peak and current bandwidth usage.
Network stats are now updated every minute, so that we have them handy for
printing in logs, or by issuing the !stats command.

Note: this checkin disables the once-per-hour stats logging.
I do not know wether or not that is useful functionality.
2009-03-04 18:36:45 +01:00
Jan Vidar Krey
bcbcf89e38 Use proper formatting for uptime command. 2009-03-04 14:49:33 +01:00
Jan Vidar Krey
26766d8332 Optimization: Removed unneeded strlen() calls several places. 2009-03-02 19:41:49 +01:00
Jan Vidar Krey
ac56e7a5b9 First git commit. 2009-02-19 17:14:09 +01:00