Dave West [Fri, 7 Dec 2007 15:09:20 +0000 (15:09 +0000)]
Hunting a bug in scheduled threads that caused a segflt. Got it and
squished it. We needed to clear next and prev before linking the
scheduled thread onto the running thread list.
Dave West [Thu, 6 Dec 2007 22:44:34 +0000 (22:44 +0000)]
Added the functions to allow scheduling of a thread to start at some
time in the future.
Fixed a bug in garbage collection that caused a corrupted thread list
when unlinking dead threads.
Fixed a bug in context_cleanup, the ContextList needed to be updated on
each pass since a module may try to iterate the list as a result of the
event triggerred here.
Art Cancro [Thu, 6 Dec 2007 05:11:05 +0000 (05:11 +0000)]
Began (but did not complete) implementation
of XEP-0078 - non-SASL authentication for Jabber sessions.
This is a deprecated protocol but some clients (such as
CenterIM) still seem to use it.
Dave West [Wed, 5 Dec 2007 21:03:04 +0000 (21:03 +0000)]
Prevent the creation of new threads if system load climbs at shutdown
time.
Also turn signals back on for threads. For some reason we occasionally
crash on the shutdown but enabling signals in the threads seems to stop
this????? Also ecrash needs the signals turned on.
Dave West [Wed, 5 Dec 2007 20:17:22 +0000 (20:17 +0000)]
Changed the way we do the TSD area.
Now this code is in sysdep.c
Added an element to the TSD to store a pointer to this threads control
structure. This allows a speed up in CtdlThreadSleep(),
CtdlThreadCheckStop() and the odd one or two other places since this
thread no longer needs to search the list of threads to find its own
control ctructure.
Dave West [Tue, 4 Dec 2007 17:10:32 +0000 (17:10 +0000)]
Changed the way we name threads. Now we use a const char *.
CtdlThreadName now takes a const char * and returns a const char *
It is up to the caller to make sure the name never goes out of scope.
* applied Patrick Colemans patch
* patched CtdlDoIHavePermissionToPostInThisRoom to enable anonymous posting to non-aide-only post rooms
* first starts on bug 209 to get more versatile email interfaces.
Dave West [Mon, 3 Dec 2007 22:00:48 +0000 (22:00 +0000)]
Added an entry point to the modules init stuff.
The new entry point is defined by the macro
CTDL_MODULE_UPGRADE(module_name).
This entry point works in much the same way as the init entry point
except it is called before the init entry point. This entry point is
intended for use as its name implies. The module should do any upgrade
stuff it needs to do before it can initialise.
serv_upgrade.c demonstrates the useage.
Art Cancro [Mon, 3 Dec 2007 07:22:43 +0000 (07:22 +0000)]
Only send presence notifications when the first
concurrent session for a user logs in, or when the last
session logs out. Also handle stealth mode semantics.
Art Cancro [Mon, 3 Dec 2007 02:44:20 +0000 (02:44 +0000)]
* WebCit now clarifies, using a localized message (or at
least it will be localized once the translators catch it) the
error condition which occurs when an administrator attempts to
create a new user from within Citadel while running in host
auth mode.
* Wrapped an ifdef around some calendar code that should be disabled
when libical is not present.
* since we now require a new libical version, remove glitch in availability.
* configure now requires libical-0.30
* webserver shuts down libical, valgrind doesn't mention ical anymore now.
Dave West [Fri, 30 Nov 2007 23:31:56 +0000 (23:31 +0000)]
Removed the PushName and PopName debugging macros that I added. They
cause a boom in the auto purger due to some change in the tsd I think.
Anyway, they've servered their purpose now.
Dave West [Fri, 30 Nov 2007 22:11:40 +0000 (22:11 +0000)]
Now we reduce the number of threads if the load conditions are
low. This way we can be nice to other things that might be running on
the same machine by releasing some resources back to the system.
Dave West [Fri, 30 Nov 2007 21:56:02 +0000 (21:56 +0000)]
Moved the garbage collection and threding init stuff into a seperate
function from main()
Also start the same number of threads that it says in the config.
Dave West [Fri, 30 Nov 2007 19:47:29 +0000 (19:47 +0000)]
Don't queue up all the worker threads waiting for the session table in
dead_session_purge(). If it is locked just get out. If that leaves a
dead session/context or two lying around then no biggie because the next
time through will clean them.
Dave West [Fri, 30 Nov 2007 18:56:48 +0000 (18:56 +0000)]
Fake a lower load average of new threads. When starting threads based on
load this causes a new thread to affect the load more so it gets chance
to start doing things. Otherwise we might start more threads than we
need to.
Dave West [Fri, 30 Nov 2007 17:19:24 +0000 (17:19 +0000)]
To lock or not to lock before signalling a condition?
Some docs imply one should lock.
Some docs say to release all locks before signalling the condition.
Art Cancro [Thu, 29 Nov 2007 23:00:44 +0000 (23:00 +0000)]
Initial code to output any instant messages which
have arrived for the user. The Citadel server's built-in
infrastructure for asynchronous (unsolicited) protocol messages
made this really easy.
Art Cancro [Thu, 29 Nov 2007 15:52:18 +0000 (15:52 +0000)]
Slight change to the way we offer XMPP stream features.
Before authentication, the only feature we offer is SASL, implying to
the client that the only thing it is allowed to do is log in. After
a successful SASL authentication, which causes the XMPP stream to be
restarted, the features we offer are sessions and binding, but not
SASL. This allows clients to initialize in the correct sequence and
guarantees that we will have an email address to use in the JID.
Art Cancro [Tue, 27 Nov 2007 22:40:47 +0000 (22:40 +0000)]
When restarting the XMPP stream after a successful
SASL authentication, don't offer SASL as a stream feature
again. This causes the client to attempt re-authentication
and/or go into an error condition.
Dave West [Tue, 27 Nov 2007 20:00:11 +0000 (20:00 +0000)]
Added --with-threadlog. Use this if you want the thread table written to
the log.
Fixed CtdlThreadName(char *name) now renames thread to name if name is
set and always returns old name caller frees old name.
Added a couple of macros to change the thread names in some places for
debugging.
Art Cancro [Tue, 27 Nov 2007 17:54:19 +0000 (17:54 +0000)]
Checked in my initial work on an XMPP (Jabber) service.
This does not yet work at all. Don't even try to use it.
I'm only checking it in so it gets backed up.
Dave West [Tue, 27 Nov 2007 13:09:40 +0000 (13:09 +0000)]
Debug code to show thread table is now back in. Thiss will fill your log
file.
Added number of threads to INFO command
Changed calc for load averages, now it is a percentage.
Dave West [Tue, 27 Nov 2007 01:21:13 +0000 (01:21 +0000)]
Now do garbage collection every second.
Change the way load averages are calculated.
Now calculate a load average for worker threads as well as the entire
system.
Display the load averages in the INFO command system then worker.
Remove all the extra debug info from garbage collector.
Art Cancro [Mon, 26 Nov 2007 04:36:01 +0000 (04:36 +0000)]
Fixed bug 301. /listsub operations do not require a
security nonce because they do not maintain an ongoing session
with the server. Also cleaned this screen up visually.
Dave West [Mon, 26 Nov 2007 01:20:56 +0000 (01:20 +0000)]
Fixed the clean up of Contexts when we exit.
Do we need to clean up some of the contexts pointers too?
serv_calendar.c now cleans up with a CleanupHook.
Dave West [Sun, 25 Nov 2007 22:15:18 +0000 (22:15 +0000)]
Here it is, the new thread interface.
The code to handle threads is in sysdep.c
This new thread interface has caused a change to the way modules are
initialised. A modules init function is now called twice. First time
threading==0, second time threading==1. threading is a parameter passed
to the init function.
You should not create a thread until your init function has been called
with threading==1. See serv_fulltext.c as an example.
All of the modules init functions have been updated for this change.
The old RegisterThread stuff has gone away.
time_to_die has gone as it was used to tell threads to exit, we now use
CtdlThreadCheckStop() instead which return non zero if the thread should
exit.
The server will exit when all threads have stopped.
CtdlThreadCreate() handles creation of threads in a safe manner.
CtdlThreadSleep() is used to do a sleep in a thread.
CtdlThreadStop() is used to stop a thread.
CtdlThreadStopAll() stops all threads and thus causes the server to
exit.
Threads are cleanup when they die by the main server process (every 10
seconds) which originally did nothing useful.
CtdlThreadGC() will force a garbage collection now.
CtdlThreadGetCount() return the number of threads in the system not just
the number of workers.
CtdlThreadSelf() returns a pointer to this threads thread structure.
CtdlThreadName() returns a strdup'd string that is the threads name, you
need to free this. It also allows you to change a threads name.
CtdlThreadCancel() does the same as pthread_cancel except it also
informs our thread system. Don't use this if you can help it.
There are a lot of debug messages at the moment, they will go away once
stability is proven.
Art Cancro [Wed, 21 Nov 2007 19:13:13 +0000 (19:13 +0000)]
Changed the column headers in the user list to
reflect modern terminology. Last Call is now Last Visit, Calls is now
Logins, and Posts is now Messages.
Art Cancro [Wed, 21 Nov 2007 04:54:19 +0000 (04:54 +0000)]
struct CitContext no longer contains separate module-specific pointers for
things like IMAP state, SMTP state, POP3 state, managesieve state, etc.
These four modules now use a single 'service_specific_data' pointer, which
is cast to whatever data type the module is using. This is possible because
only one is used at a time (a session cannot be POP3 and SMTP simultaneously,
for example). As before, when a module allocates memory and places
a pointer to it in this location, the module's cleanup function
continues to be responsible for freeing it, and as before, it must not
free this pointer under any other circumstances.
Third-party modules which implement new server protocols now have a place
to store session data without modifying the server core. Just follow one
of the existing server protocol modules as an example.