CVS log for epic5/source/newio.c |
![]() |
Request diff between arbitrary revisions
* Roll in a bunch of changes from larne to make epic5 more vms-friendly * Rename if.h -> ifcmd.h (larne) -- Make sure you rerun configure! * Run make depend to pick up name change of if.h * Check for <sys/param.h> in configure (larne) * Extern funcs are case insensitive in strict c90, fix (larne) * Rename options -> options.h since vms requires a dot in filename (larne) * Change "readonly" -> "rdonly" since "readonly" is a symbol in vms. (larne) * Pull in "compat.h" for gailib.c and glob.c (larne) * Set stdout to be explciitly line buffered at startup (larne) * Returning a value from void functino forbidden by strict c90. fix (larne) * Fix some compiler warnings that were lying around. * There are more changes forthcoming, these were the easy ones.
Remove u_* bsd-isms so we can compile with -ansi on linux.
* Add new level SYSERR (see UPDATES) * Add a server refnum to syserr() to send the syserr to the proper window. * Add a server refnum to new_open() so we can pass it to syserr(). * Add new flag to /XECHO, /XECHO -AS (output to all windows on server) * This should make syserrs go to the "correct window" most of the time (larne)
* Add arg to panic() controlling whether panic is sent via QUIT (rb black)
* Interrogate, and pass upwards, the socket error from getsockopt() for nonblocking connects, and then output that error to the user. Requested by twincest.
* Change startup code so it outputs the pid of the bot process for -b. * Fix $info(o) bug. rb zlonix * Output the errno value ret by failed nonblocking server connects on error. * Add auto-close boolean flag for server (see UPDATES)
* Fix from black for 'save' script, to save notify nicks. * Fix from larne for configure checks for tcl for solaris (ick) * Fix solaris ports support, inspired by patch from larne, rb zlonix
Fix some bugs with /window query that kreca found.
* Fix breakage for solaris found by zlonix
* Fix %{2}+ so it behaves like %+ and not like %{1}+, as per the docs.
Fix cut & paste error. doh.
* Add SEDSHA cipher type, which is better than SED, and always available. * Add my_sleep|isreadable|iswritable() funcs to phase out rogue selects()h * Add support for multiple concurrent servers to /encrypt. yay! * Store the length of the Crypt key within the key itself. * This moves us closer to being able to decrypt arbitrary data. * Test all of the cipher types, incl. compat of CAST with ircII. All set!
* Support cast5/blowfish encryption a la ircII. * Fix build for non-ssl users.
* Support AI_ADDRCONFIG in our builtin AI_MASK/getaddrinfo(). * Make set[_non]_blocking extern. * Support NEWIO_SSL_CONNECT as a new_open() type. * Add a new ssl_connect() io callback function for NEWIO_SSL_CONNECT. * New scripts from weirdo: autojoin, autoquery, floodprot, renumber * New version of reconnect script from weirdo. * GC the fixed-alist support (last used by /quote and protocol handler) * Reorg server SSL negotation stuff to be nonblocking. yay! * Comment all sorts of stuff in ssl.c.
* Add support for dgets buffer type -2 (only return full buffers) * Use buffer type -2 for reading nonblocking dns addrs, fixes probs on solaris.
* Improve /dcc get * Fix warnings
* Add marshalling functions for getaddrinfo() * Use getaddrinfo marshalls + dgets to simulate nonblocking dns lookups. * New newio io type, "NULL" which i'll probably whack later.
Add support from larne for solaris ports, which I modified up a bit, so if there are any problems, blame me, and not him!
* Change /on leave to /on part. * Only ever do one io event per call through select() or poll() * Do put_echo() and not add_to_screen() in /window echo so it can be logged
* Take a new arg to new_open() to control whether INFO -- errors are output. * Don't output the "INFO --" things for dcc or execs
Fix fd leak, observed by ce.
* Change "ERROR --" to "INFO --" to not alarm people as much. * Change a few other warnings to not be so alarming. * Change new_realloc() to not move ptr if it is big enough to hold new size. * Fix all the status_* sub-formats to not have any hardcoded size limits.
* Prefer timers over i/o to prevent polling loop panics.
Don't emit spurious warnings for control-c
* Fix SSL with pthreads -- need to establish SSL before calling SSL_read! * Fix compiling with kqueue, call it --with-multiplex=freebsd-kqueue * Hide SSL capability behind "client_ssl_enabled()", nix all #ifdef HAVE_SSL
Fix SSL with pthreads.
* Add --with-multiplex=[select|poll|kqueue|pthread] to configure
* Check thread-safety of SSL in configure when using pthreads.
* Don't unconditionally skip leading :'s in symbol names.
* When calling functions, handle skipping leading :'s specially.
* Add support for pthread locking for ssl to ssl.c
* Add %{2}+ and %{3}+ status expandos that only show the mode string.
* Use AI_ADDRCONFIG flag to tell getaddrinfo() we only want addrs we can use.
Fix Dain Bramage.
Fix more compiler warnings.
* Refactor the error stuff by eliminating my_strerror() and dgets_errno. * Error messages are now delivered on multiple levels as info is available. * This may get annoying, but it's a lot more accurate now! * Change inet_* functions to return int's since their retval is unused. * Add a new internal "syserr()" function that generates formatted errors. * Syserr's look like say()s but they act like yell()s. (can hook with /on yell) * Keep an counter in the server stuff so we can count off as addrs are used. * So the error message in /ON DCC_LOST is always just "ERROR" now. * Fix various compiler warnings and stuff. * Add $hookctl(GET HOOK <ref> STRING), return /load'able format of ON * Fix some debugging outbound in switch_hostname(), doh! * Roll set_socket_options() into a new Socket() function. * Roll connections to AF_UNIX sockets into the mainline stuff. * Roll nonblocking/connect/nonblocking into Connect(). * Add AF_UNIX support to Getnameinfo() to remove annoying errors. * When doing recovery from EBADF in select, only check fd's we're using * Just puke if configured for kqueue() and kqueue() fails. * Don't puke on default 353 output if the userlist arg is missing. (for ratbox) * Permit doing /window name to change case of window's name.
* Implement a proper built in /INVITE command. See UPDATES * Revert 2.8script change. * Add "subpackage" command, which i'll document later. * Package up 'global', and '2.8script' and 'basical' so they can be /unload'ed. * Don't load "global" if user has their own startup script. * Don't load "global" if the -q option is set, either. * Thus, the "global" script acts as a default "epicrc" for those without one. * THIS IS BACKWARDS INCOMPATABLE. SEE UPDATES FOR IMPORTANT INFORMATION. * Nix the "loading_global" variable, only used by hooks. * Fix /on 005 so it shows the /on 005's and not all numeric hooks. * If Accept() fails, tell the user straight-way so I can debug this. * Fix /window name - so it redraws the status bar.
* Fix accept() with pthreads. Nonblocking + pthreads == Bad. * Throw away all unused addrs when we are registered, to ensure no reconnects.
Try to auto-repair select(2) failures.
Fix more bugs.
Remove a panic that broke wait().
Fix a minor brain-o.
* Refactor $sar() and $msar() so they share as much code as possible. * Refactor newio, support select/kqueue/poll (#define's in newio.h) * ... Getting closer to not needing select! * Fix SSL. * Fix a bunch of misc compiler warnings * Remove restrictions on /QUOTE, so there! * Add pthread support to newio for larne. HUZZAH! * I'm sure a zillion things are broken, so it's time to test!
* Add a dgets_buffer() to inject data into dgets() system. * Fix up dgets() so it has read() like semantics. * Fix up dgets() callers to use it like a read() type function. * Turn off /xdebug server_connected hardcoded at startup for now. * Fix up unix_* io functions to use dgets_buffer(). * Fix do_filedesc() to repeatedly call callback until buffer is clean * Move set_socket_options() to network.c, make do_filedesc() global func
Fix minor bogon (maybe)
PHEAR the breakage! * Major refactoring of newio system: * Change main io() look into a "fill" cycle and a "drain" cycle, using buffers * Change new_open() to take an io policy to perform when fd is "ready" * Use token to determine if an fd is "dirty" or "clean" (is data ready?) * Process accept()s through newio/dgets. * Merge nonblocking connects as just another type of new_open() policy. * Nonblocking connects emit sockaddr info when connected for dgets(). * Change dgets() to not perform io, but just drain from the buffer * Now all data goes through dgets()! huzzah! * Nuke kqueue support for the moment (will come back later) * Hide the "holding" status of a fd inside the IO metadata. * This allows me to support "holding" in other IO models. * Major refactoring of ssl support: * Move all meta-data about ssl in ssl.c in a linked list * As much as possible, have server treat the ssl case as "normal" * Implement all ssl interfaces even in non-ssl case, guard with panics ^^^^ None of the above should be user-visible changes.
* Fix /dmsg =<numeric> again, fix compiler warnings. * Whack dgets() into submission regarding incomplete unbuffered lines. * Revamp how partial lines from an /exec process are handled.
* Refactor window_check_servers() to work with server's current window only. * Roll forward all the rest of changes from epic4 (i think) * Add /ON NEW_NICKNAME, when epic needs a new nickname from you. * Run 'make depend', fix compile errors, fix 'environment' script
Fix a defect where, if two fd's were ready at the same time (say, dcc chats)
and in the /on for the first one you new_close() the second one, epic would
panic trying to process the 2nd connection ("got a callback, not set up").
Now we only do that panic if the 2nd connection looks like it's still valid,
which it definitely won't be after a new_close().
This bug was discovered by ce.
Fix bugorz.
Ick. Hack select__do_wait() to prefer timers over i/o. This is a nasty hack, but i think hsoc has suffered enough already.
Add some help for polling loop detections.
Expound a bit more in newio.c about the changes and purpose.
* Abstract the reading function out of dgets() via an argument * Add unix_read(), the default reader for dgets() * Add ssl_reader(), a dgets-like reader for SSL connections * Add server_ssl_reader(), a dgets reader for servers using SSL. * I probably broke SSL servers by doing this -- report bugs please!
* Abstract fd handling in newio.[ch] through #defines * Add fd handling with freebsd's kqueue(). Huzzah! (not turned on by default) * Refactor how dgets() works with incomplete SSL reads, slurp up everything * Nix the bletcherous do_server(-1) hack in io(). * Fix a few more bogons in do_server().
* Hide new_select() behind wait_select(), which will hold the result fd_set's * Don't make do_filedesc() take fd_set's, but rather get them from wait_select. * Be cautious and when redrawing one screen, redraw all screens. * Refactor io() some more; no explicit dependancy on select() now * Refactor io(), optimize placement of some of the post-select operations. * When wserv changes size, recalculate windows, and allow io() to redraw it.
* Make new_open[_for_write] take a callback function, stash it in io_rec. * Add handle_filedescs() which takes select() results and calls callbacks * Make io() call handle_filedescs() instead of the four callback functions. * This is the first stage of an extendable callback event looper! huzzah!
* Allow client_connect() to be nonblocking * Allow Getaddrinfo() and Freeaddrinfo() to be called extern. * Track writable sockets in 'global_max_fd' too. * Keep a list of AI's for server addresses in the server code * When server connection lost before registration, use the next AI * Implement set_server_status(), which controls where server is in lifetime * Nix reconnect(), which is replaced by close_server + set_server_status(). * Nix server_reconnects_to(), we no longer reconnect to servers. * Make /xdebug server_connect the default for this commit at least * Call window_check_servers() every time through io(), because... * Make window_check_servers() look for disconnected servers and restart them. * Add add_mode_to_str() which adds a channel or usermode to a string (sorted) * Make usermodes use add_mode_to_str() * Make channel modes use add_mode_to_str() * Now modes are not stored in bitmasks, not hard-coded at compile time. HUZZAH! * Nix "inactive" field in channels, channels are thrown away at disconnect * Don't allow channels to move between servers, natch. * Nix all the code to handle disconnected channels and such. * Use change_window_server() to move windows to new servers, because... * Make window_check_servers() auto-close windowless servers. * Make change_window_server(<server>, NOSERV) cause a disconnect from <server> * Don't honor /set auto_reconnect, we don't ever reconnect. * Fix printf() error in /on kick default output * Add new server state, SERVER_RECONNECT which means "i can be connected" * So now SERVER_CLOSED means "don't reconnect me" * Allow /server, /window server, and /reconnect to change CLOSED -> RECONNECT * Make server connections nonblocking. * Server connections are now nonrecursive, nonblocking, multi-protocol. HUZZAH! * GC a bunch of server code dealing with reconnection we don't use now. * Don't call window_check_servers() other than io() for sanity reasons. * Make /window server just change server, let w_c_s() bootstrap connection * Remove many window->channel->server sanity checks.
* The last argument to open_file_for_write() needs to be lowercase. * Add $numlines() from fudd. EPIC4-1.2.3!
* Rename 'dcc()' to 'dcc_cmd()' so we can use dcc as variable
* Garbage collect unused 'irc_path' global variable.
* Add --with-warns to configure to do FreeBSD "WARNS" like compiler checks
* Many hundreds of changes to improve the "quality of code" in epic, including:
* - Treat all literal strings as (const char *) and fix const correctness.
* - Mopping up all remaining const-correctness issues
* - Do not "launder" a (const char *) to a (char *) in string searches, (ala
strchr) but rather return a ssize_t offset value.
* - Particular, MatchingBracket() returns (ssize_t) and not (char *).
* - Eliminate all "shadow" variable names by changing them to something else.
* - Eliminate most function decls that do not include a prototype list.
* - Add prototypes for all extern functions that are missing them.
* - Ensure most function pointers include a prototype list.
* - In term.c, most of those (char *)'s are really (const char *)'s.
* - Explicitly specify 'static' functions as 'static'
* - Ensure every function is either 'static' or has a prototype.
* - Eliminate (unsigned) < (signed) type comparisons.
* Hopefully you should not notice any changes!
Nominally remove all uses of "unsafe" functions: (Commit 506)
* Convert all uses of strcpy() to strlcpy()
* Convert all uses of strcat() to strlcat()
* Convert all uses of strmcpy() to strlcpy()
* Convert all uses of strmcat() to strlcat()
* Convert all uses of sprintf() to snprintf()
* As much as possible, use 'sizeof var' in snprintf/strlcpy/strlcat.
* Qualify the size of some global vars so we can sizeof() them.
* Nuke strmcpy(), strmcat(), strmcat_ue(), strmccat(),
* Change strmopencat() to strlopencat().
* Change strmpcat() to strlpcat().
* Fix switch_hostname so it doesn't return a (const) string.
* Fix TimerTimeout so it doesn't return a (const) Timeval.
* Change things like (ret) to do ret while (0); for when "ret" is "{}".
* Fix initialization for load_level
* Stop passing in static strings into io(), so we can modify them.
* Make messages passed to io() more informative to the user.
* Fix CTCP FINGER handler not to assume (struct pw) strings can be overwritten.
* Use (socklen_t) and not an (int) for socket sizes.
* Don't return a value in a void function...
* Don't use return value of process_dcc_chat_ctcps() for assignment.
* Don't put semicolons after function bodies
* Fix $getopt() to save 'input_size' so we can use it with strl*().
* Convert all uses of stpcpy() to strlcat() and strlopencat().
* Nix checks for stpcpy() in configure -- regen configure.
Another merge.
* Reorganize param list to dgets() to include a length argument * Add (set|get)_server_line_length(), the maximum size of an irc protocol line. * Convert dgets() callers to the new calling style.
* $dccctl() changes as per UPDATES. * Misc bug fixes as per KNOWNBUGS.
Yikes. Merged to become consistent with HEAD. Sorry for all the commits, I'll be quiet again soon. :) -wd
* CTCP-over-DCC fix. There are some things that confuse me about the inner
workings here, so I'm not sure if this fix was done properly, but I did
a few tests including a DCC send over a SED encrypted DCC and everything
seems to tick over well.
* Unix socket configure tests as per KNOWNBUGS.
* /set flood_ignore defaulted to off.
* Tuned commandqueues.
* The 324 hook is now called for joins as well.
* %{1}D status setting as per UPDATES.
* DCC hold mode as per UPDATES.
Fix all the rest of the compile issues. bleh.
Fix build error on non-ssl systems.
* Remove colon at end of RETURN_MSTR so it is like others. * Unify dgets() and SSL_dgets() * Add a 4th argument to dgets(), an (SSL *) for ssl reads, NULL for normals * Integrate SSL stuff more tightly by removing unecessary #ifdef's * Change 'enable_ssl' to 'try_ssl' to avoid confusion with 'ssl_enabled' * Remove uneccesary members of (Window) * #include "functions.h" in any file implementing built in functions. * panic if ssl op attempted on non-ssl connection. * Don't call functions in RETURN_* macros. (they're evaled twice) * Nuke #ifdef 0'd uses of 'ceiling_of_display'
* Use server_list_size() and not number_of_servers outside of server.c * Use NOSERV and not -1 for "no server" * Use (Timeval) and not (struct timeval) * Fix (get|set)_server_sent_*() et al to take server refnum. * Use parse_server_index() and not my_atol() to parse server refnums * re-indent quotecmd * Rename is_server_connected() to is_server_registered * Make /quote work as long as server is open (not registered) * Use send_to_aserver() when it can avoid setting from_server unecessarily * Change sent_to_server and clear_sent_to_server to (set|get)server_sent(). * Change doing_* to get_server_doing_*. * Use (unsigned short) and not (u_short) * Use (unsigned long) and not (u_long) * Make output_reject_ctcp() take a refnum * Lock a dcc while we are connecting it, just in case. ;-) * Fix /dcc send -p <port> * Store protocol enforcements as (get|set)_server_protocol_state(). * Use (Stat) and not (struct stat) * Rewrite $timerctl() so it works like $logctl() * Rename is_server_connected() to is_server_registered() * Fix an off-by-one error with /FOR ... IN ... * Keep track of both readable and writable fd's with newio stuff. * Convert server_list to an array of pointers * When user /server -delete's, leave a gap, don't change refnums around. * Nix code that handles deleting server refnums. * New function, new_open_for_writing(), for when we do nonblocking connects. * Change new_open() to deregister fd as "writable" * Renovate the notify stuff to take refnums and not just use from_server. * Renovate /WHO, /ISON, /USERHOST to take refnums and not just use from_server. * Make everything that uses server_list[] use get_server() instead. * Make everything capable of dealing with "gaps" in server_list[]. * Use a bunch of macros, to handle with getting and setting server attrs. * Make as much as possible use refnums as params and not from_server. * And a lot of other stuff...
* Change do_input_timeouts() to a timer callback. * Nuke the now unused global /wait stuff * Revamp timer.c so you can add/change/delete/update timers during a timer * Change add_timer() so it takes a winref not a window pointer. * Make the "key timeout" thing happen on demand instead of a recurring timer * Remove the recurring "key timeout" timer. * Remove the 'key timeout' thing from io(), also 'first time' stuff. * Call get_time() after select() in io(). * Fix two compile bugs found by larne. * Fix bug when you did /flush on a /clear window.
Update copyright notices and copyright dates.
No functional changes, just removal of unecessary whitespace at the end of lines. From adm.
Fix new_select() to not expose a file descriptor with ready (cached) data unless the caller said they were interested in that file descriptor.
Applied the SSL patch from ay-ar. Details are in README.SSL. This works well at this point, but there may be teething problems.
Actually test for polls correctly in the sub-second-resolution world; second == 0 and usecond == 0.
Initial import into CVS
Initial revision
| CVS Admin |
Powered by ViewCVS 0.9.2 |