Commit Graph

31 Commits

Author SHA1 Message Date
Kevin Easton
2fa0bf818a Replace uses of HAVE_SSL with HAVE_LIBSSL
autoconf's AC_CHECK_LIB automatically sets HAVE_LIBSSL, whereas HAVE_SSL has to be set manually.

This prepares us to remove some code from configure.
2017-03-17 00:07:38 +11:00
Kevin Easton
04cf832604 Change send_msg_to_channels() to remove 'channels' argument and always use PRIVMSG
The 'channels' argument was unnecessary because the channel list passed to it would
always be from get_server_channels(server) anyway.

Changing the message argument from a protocol message format string to a plain payload
string for PRIVMSG means printf-escaping of the argument is avoided in the caller.
This simplifies the callers and means we can remove the last use of quote_it().

This change also switches set_server_away() to use send_msg_to_channels() instead of
open-coding the equivalent, which simplifies that function a lot.

We are changing the signature of a function exported to modules here; however none
of the in-tree modules use this function so it should be OK.
2016-10-13 01:36:19 +11:00
Kevin Easton
58588946e0 Simplify send_to_server functions by adding server parameter to vsend_to_server() 2016-10-02 22:44:06 +11:00
Kevin Easton
ce3fd79652 Global spelling fix s/recieve/receive/ across codebase
This includes some user-visible messages and help files, so if anyone has
hooked them with /ON WINDOW their hooks will need updating.
2015-10-04 09:06:38 +11:00
Kevin Easton
8cc9684c76 Ensure close_server() clears the who/ison/userhost queues for the right server
close_server() should call clear_server_queues() on the server that's being
closed, not from_server.  This also lets us remove a few other calls to
clear_server_queues() that are right next to calls to close_server().
2015-09-07 16:34:41 +10:00
Kevin Easton
bc94fbe64a Remove a strange old piece of code apparently for detecting a server gone to lunch
This code appears to be some kind of backstop so that the client will notice
a server connection that's died because of a network interruption.  Checking
errno that was last set christ-knows-where is not the right way to do this,
though.

The normal write to the server for the lag check should eventually see the
host/net unreachable error if this happens.
2015-06-13 22:35:03 +10:00
Kevin Easton
b0951d44dd Simplify and make static reconnect_server() function 2015-06-13 22:30:44 +10:00
Kevin Easton
6dbc712046 Rework and improve the scheduling of the server lag check
Previously the server lag check was run by update_clock() if the number of
seconds since client startup was a multiple of 20 (unless it had already been
done this second).  This meant that if update_clock() was not being called
frequently (eg. if your IRC connection was very quiet), it might go a long
time between lag checks.

This commit adds a /set LAG_CHECK_INTERVAL (defaulting to 30).  For each
server, a lag check ping is scheduled for every LAG_CHECK_INTERVAL seconds
after the connection is finalised/registered.  Setting this value to 0
disables the lag check pings entirely.

The old code set the lag to 'unknown' immediately after sending out a ping,
which meant that it was quite unpredictable how long the lag value would
stay around for.  The new code only sets this once the current lag value
has become stale (ie. a ping reply is overdue based on the current lag
value).  If your lag is staying the same or reducing, you shouldn't see
the [Lag ??] at all.
2015-06-12 15:54:43 +10:00
Kevin Easton
c0c7cdbdcc Rework the calculation of the select timeout in io() to be based on absolute wake time
An absolute wake time is now calculated and updated by set_server_bits(),
TimerTimeout() and tclTimerTimeout().  This is then used to calculate the actual
select() timeout, instead of having those functions calculate a relative timeout
value themselves.  This significantly simplifies those functions, since the
underlying values tend to be recorded as absolute times.

It also allows us to disentangle tclTimeTimeout from TimerTimeout(), and move the
responsibility for calculating the QUEUE_SENDS wake time from TimerTimeout() to
set_server_bits() where it belongs.

The QUEUE_SENDS and CONNECT_DELAY wake up times will also now be correctly
calculated, based on the last sent time and connect time respectively.
2015-06-07 00:03:09 +10:00
Kevin Easton
f1c27a4f64 Switch server->connect_time from time_t to struct timeval
This means that settings like CONNECT_DELAY and CONNECT_TIMEOUT are compared
against the current time with sub-second resolution.  With the old way, the
delays could be up to a second longer than asked for, which had the effect of
almost doubling the default CONNECT_DELAY value of 1.
2015-05-13 23:17:18 +10:00
Kevin Easton
0f8280ed51 Prevent indefinite wait if CONNECT_DELAY is set to zero
set_server_bits() now returns -1 for "no timeout", so 0 is a legitimate
return value.

io() should only update real_timeout from server_timeout if server_timeout
is not -1 (real_timeout == -1 ends up meaning "wait indefinitely").

Note that if you set CONNECT_DELAY to zero you get a lag check ping sent off
first thing in the server connection, this should be fixed.
2015-05-12 22:39:30 +10:00
Kevin Easton
9f7cf6b6c2 Alter the way PINGs for /sping and lag check are used.
We now send PING <server> :<server> for /spings, and
PING LAG!<cookie>.<tv_sec>.<tv_usec> :<server> for lag checks.  The cookie is
set randomly at server connect time, and means that clients connected to the
same bouncer shouldn't act on each other's lag checks.

We can now remove in_sping entirely - previously it would get out of synch if
you disconnected with a sping in progress.
2015-05-04 00:13:08 +10:00
Kevin Easton
3b99834e00 Partially revert r456.
An snprintf() call that creates IRC protocol messages must use 
(MAX_PROTOCOL_SIZE + 1) as 'n' rather than the buffer size.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@461 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-13 09:57:15 +00:00
Tim Cava
317b84ee9d Convert sprintf calls to snprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@456 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-11 21:29:00 +00:00
Tim Cava
112b38ac7a Revert the last commit. It accidentally had autogenerated files in it.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@432 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-07 03:00:24 +00:00
Tim Cava
276fd24258 Use snprintf rather than sprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@431 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-07 02:41:16 +00:00
Tim Cava
a3ab6659fc Refactor vsend_to_server() with help from caf.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@410 13b04d17-f746-0410-82c6-800466cd88b0
2013-10-26 00:49:30 +00:00
Tim Cava
e4e8a1358a Use strlcpy, rather than strmcpy, in show_server_map().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@327 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 10:41:00 +00:00
Tim Cava
72cf367e45 Use strlcpy, rather than strmcpy, in accept_server_nickname().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@326 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 10:35:43 +00:00
Tim Cava
68c3df7c6c Use strlcpy, rather than strmcpy, in set_server_nickname().
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@325 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-15 10:28:56 +00:00
Tim Cava
e070369079 Make the namelen passed to getsockname() a socklen_t everywhere.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@280 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 03:26:00 +00:00
Tim Cava
80cfa9c5d8 Make the namelen passed to getpeername() a socklen_t everywhere.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@279 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 03:18:47 +00:00
Tim Cava
27ed98a03d Make the addrlen passed to my_accept() a socklen_t everywhere.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@278 13b04d17-f746-0410-82c6-800466cd88b0
2013-07-14 03:09:16 +00:00
Kevin Easton
1541299fa1 Merge infrastructure for SASL authentication support from flashback.
This includes all of the underlying support, but doesn't hook it up to the
/SERVER command yet, so it's not useable at this point.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@216 13b04d17-f746-0410-82c6-800466cd88b0
2012-12-30 02:22:56 +00:00
Tim Cava
416fcda578 Fix QUIT messages with SSL connections.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@212 13b04d17-f746-0410-82c6-800466cd88b0
2012-09-20 02:36:48 +00:00
Kevin Easton
5222ce2f1d Move window_check_servers() call out of loop, otherwise the client does a
huge amount of work on each keystroke if you have a long server list and
start it up disconnected (-N).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@150 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-10 12:38:08 +00:00
Kevin Easton
d1e13bc526 Show correct message ("Remote end closed connection") when we get EOF
on a socket.

I also added a wrapper function around strerror() for dgets_errno, since
we did the same thing in a few places.  This all needs to be cleaned up
a little - the -1 value we use could in theory clash with an actual
errno error number.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@104 13b04d17-f746-0410-82c6-800466cd88b0
2010-09-30 13:26:06 +00:00
Kevin Easton
789ed916cd Backport changes from epic5 to make recv_nick, sent_nick and sent_body
per-server, and apply new version of do_oops from flewid (the BX2 version). 

This means that /oops, "/query .", "/query ,", "/msg ." and "/msg ," are now
per-server, along with the $. $, and $B aliases.



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@87 13b04d17-f746-0410-82c6-800466cd88b0
2010-06-26 08:18:34 +00:00
Kevin Easton
eb13453e50 Fix snprintf() call in /QUIT to make glibc2.9 happy.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@67 13b04d17-f746-0410-82c6-800466cd88b0
2009-09-08 13:22:27 +00:00
Kevin Easton
533c3dbcbf Turn on SVN keyword replacement for $Date$, $Author$, $Revision$, $Id$ for all
*.c and *.h files.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/branches/ircii-pana-1.1@3 13b04d17-f746-0410-82c6-800466cd88b0
2008-02-25 09:49:14 +00:00
Kevin Easton
28febcfea9 Initial import of the ircii-pana-1.1-final source tree.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/tags/ircii-pana-1.1-final@1 13b04d17-f746-0410-82c6-800466cd88b0
2008-02-25 09:25:32 +00:00