Commit Graph

75 Commits

Author SHA1 Message Date
Uli Schlachter 789f1ff7b5 Update to latest Csocket
This fixes the "busy loop waiting for an SSL handshake to finish" which the last
"Update to latest Csocket" was already supposed to fix. However, that fix had a
bug if poll() is used instead of select().

poll()'s timeout argument is in milliseconds while select also allows
microseconds. Since Csocket originally used select(), it expects the
microseconds-approach. This means it has to divide by 1000 to get the timeout
argument for poll().

However, the iQuickReset which was used to "fix" (rather: hide) the busy loop
was less than 1ms so this still resulted in a timeout of 0 (= busy loop) because
integer division truncates the result.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-13 20:47:56 +02:00
Uli Schlachter 88e7f093a1 Update to latest Csocket
Fixes:

- A possible crash bug for empty DNS replies with c-ares. E.g. a AAAA lookup for
  google.com doesn't give any reply but is still successful. This might be a
  c-ares bug (there is ARES_ENODATA) or c-ares just changed its behavior?
  (No bug report, just noticed accidentally)
- Connecting to ipv4-only hosts with a v6 bindhost caused weird errors:
  https://github.com/znc/znc/issues/47
- There was a pull request for some DSA server certificate thingy:
  https://github.com/znc/znc/pull/46
- Busy loop waiting for an SSL handshake to finish:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631590
- Some other stuff? No idea what some of the changes in here are actually doing.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-06-26 12:11:40 +02:00
Un1matr1x 708366d9ae remove some more of the evil trailing white spaces & tabs 2011-06-09 21:29:13 +02:00
Uli Schlachter 6e48f3535c Update to latest Csocket
This fixes a problem where Csocket detected socket timeouts (as configured with
SetTimeout()) too late if there was few activity. See csocket's git commit
message for more info, I'm lazy. :-P

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-30 12:29:12 +02:00
Uli Schlachter cc552fb3f5 Update to latest Csocket
We are using a vanilla version of Csocket again. Previously, our copy of
Csocket.h had a new '#include "zncconfig.h"'.

The other changes are mostly cleanup for various compiler warnings. The switch
from inet_ntoa() to inet_ntop() is for thread-safety reasons.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-18 11:56:39 +01:00
psychon 3ecbf13390 Use autoheader
This commit adds a zncconfig.h to ZNC that is automatically generated by
configure. This is done because the -DPACKAGE_STRING=\"znc\ 0.097\" that
configure adds to CXXFLAGS breaks znc-buildmod.

This means that we have to include zncconfig.h as the very first header in every
C++ file that is compiled. This commit kinda cheats and instead adds this
include as the very first thing to all header files we have. This should
hopefully mean that modules don't have to include this.

Because Csocket includes defines.h too late, this commit causes znc to divert
from upstream Csocket once again. :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2250 726aef4b-f618-498e-8847-2d620e286838
2011-01-07 15:01:08 +00:00
psychon d8f4e31939 Update to latest Csocket
Csocket switched from CVS to git, yay!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2170 726aef4b-f618-498e-8847-2d620e286838
2010-11-06 15:15:09 +00:00
psychon a785b0dc08 Csocket: Fix a bug with poll() and CExecSock
select() says a socket is readable when the other end hangs up, with poll() you
only get POLLHUP. These other flags should all be handled like POLLIN.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2165 726aef4b-f618-498e-8847-2d620e286838
2010-10-24 09:04:17 +00:00
psychon e48a6be48d Update to latest Csocket
This fixes a busy-loop bug with openssl and adds support for using poll()
instead of select().

Currently, poll() isn't used unless you use
./configure CXXFLAGS="-DCSOCK_USE_POLL".


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2096 726aef4b-f618-498e-8847-2d620e286838
2010-08-03 11:37:52 +00:00
psychon 3bdb150d9a Update to latest Csocket
This fixes a bug where the wrong errno value was used for SockError(). This also
fixes a busy loop caused by broken c-ares timeout handling on our side.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2052 726aef4b-f618-498e-8847-2d620e286838
2010-07-02 20:03:41 +00:00
psychon 635fb4bc00 Update to latest Csocket
This adds Csock::ConvertAddress() which produces printable addresses. We use
this function in CZNCSock to strip away 4in6 prefixes (e.g. ::ffff:127.0.0.1).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1930 726aef4b-f618-498e-8847-2d620e286838
2010-04-25 11:17:42 +00:00
psychon e77adef048 Update to latest Csocket
This gets rid of some openssl-related warnings from valgrind's memcheck and adds
Csock::GetPeerFingerprint().


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1905 726aef4b-f618-498e-8847-2d620e286838
2010-04-11 19:00:30 +00:00
psychon 8d37abf312 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1814 726aef4b-f618-498e-8847-2d620e286838
2010-03-07 15:46:36 +00:00
psychon f5ede26cea Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1766 726aef4b-f618-498e-8847-2d620e286838
2010-02-18 13:04:11 +00:00
psychon c7546c0c05 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1727 726aef4b-f618-498e-8847-2d620e286838
2010-01-28 19:55:23 +00:00
imaginos ebbc126b72 cleanup some, and aggregate common code
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1713 726aef4b-f618-498e-8847-2d620e286838
2010-01-15 20:19:02 +00:00
imaginos ca1e8d43c3 added workaround for a canonical name that points to ipv6 and ipv4 ip's, the ipv6 ip is tried first, followed up by a final try on ipv4 in the event the ipv6 connect results in a network unreachable. I wonder what this will break ...
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1712 726aef4b-f618-498e-8847-2d620e286838
2010-01-15 19:45:58 +00:00
imaginos 5ea1f8cc05 bring csocket changes up to date with win32 fixes provided by DGandalf, also forgot to implement ares_timeout
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1708 726aef4b-f618-498e-8847-2d620e286838
2010-01-12 18:51:31 +00:00
cflakes 25ef34398d Update to latest Csocket. A Thank You goes out to DGandalf for noticing a bug in Csocket's c-ares code and another one of course to Imaginos for promptly looking into and fixing this.
The issue was that a timeout was being applied when c-ares really takes care of timeouts.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1707 726aef4b-f618-498e-8847-2d620e286838
2010-01-12 00:28:24 +00:00
psychon 6ce29e77f2 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1683 726aef4b-f618-498e-8847-2d620e286838
2009-12-19 16:29:26 +00:00
psychon 9bb57639e1 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1615 726aef4b-f618-498e-8847-2d620e286838
2009-09-02 17:26:06 +00:00
psychon f77e526652 Add c-ares support
Every socket which is based on CZNCSock will now use c-ares for its name
resolving. This is possible thanks to CSocket's Csock::GetAddrInfo() which
lets one override the DNS lookup.

This can be disabled with --disable-c-ares.

If IPv6 is enabled and Csocket didn't specify which kind of lookup (ipv4/ipv6)
it wants, we first do an ipv4 lookup. If that lookup doesn't yield any useful
result, we try again with an ipv6 lookup. If one wants to force ipv6 usage on a
domain which also resolves to an ipv4 address, he has to set an ipv6 vhost.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1551 726aef4b-f618-498e-8847-2d620e286838
2009-06-30 09:56:01 +00:00
psychon 763e3b2c9f Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1546 726aef4b-f618-498e-8847-2d620e286838
2009-06-26 08:45:08 +00:00
psychon 37d0c5e58e Update to latest Csocket
Thanks to Imaginos for implementing this. :)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1509 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 08:10:00 +00:00
psychon 6faf0980b9 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1490 726aef4b-f618-498e-8847-2d620e286838
2009-04-13 08:18:35 +00:00
psychon 0f52550e09 Add defines.h for Csocket and make Csocket use ZNC's DEBUG()
This adds a new file defines.h and moves all the Csocket specific stuff from
main.h into this new file.

Then this makes Csocket use ZNC's DEBUG() macro for its debug output which
means this can now also be enabled by running znc --debug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1445 726aef4b-f618-498e-8847-2d620e286838
2009-03-25 17:56:29 +00:00
psychon 9a2e17c657 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1444 726aef4b-f618-498e-8847-2d620e286838
2009-03-25 15:38:11 +00:00
imaginos 27169de501 fixed bug in wrong iterator increment that causes infinite loop
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1433 726aef4b-f618-498e-8847-2d620e286838
2009-03-18 23:55:56 +00:00
psychon a2abf0fd44 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1407 726aef4b-f618-498e-8847-2d620e286838
2009-03-03 11:09:44 +00:00
psychon 9210bdc97e Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1335 726aef4b-f618-498e-8847-2d620e286838
2009-01-18 10:32:16 +00:00
psychon c03bd91589 Update to latest Csocket and use its new init interface
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1288 726aef4b-f618-498e-8847-2d620e286838
2008-12-10 15:53:07 +00:00
psychon 583b91f719 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1225 726aef4b-f618-498e-8847-2d620e286838
2008-09-28 17:17:46 +00:00
psychon c3b6a4b29a Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1159 726aef4b-f618-498e-8847-2d620e286838
2008-08-18 11:10:27 +00:00
psychon 5665fd872d Update to latest Csocket
This breaks (& fixes again, as far as ZNC itself is concerened) API!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1040 726aef4b-f618-498e-8847-2d620e286838
2008-05-06 14:47:13 +00:00
imaginos 1f4963c452 extra line breaking shit, its not supposed to be there :P
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1015 726aef4b-f618-498e-8847-2d620e286838
2008-04-03 15:43:52 +00:00
imaginos 3583b4b5de fix state bug when connecting to a remote host thats ssl, results from a hostname that resolves to multiple ip's
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1013 726aef4b-f618-498e-8847-2d620e286838
2008-04-02 16:15:24 +00:00
imaginos 493d515490 this should fix all the ipv4/ipv6 issues, tested it on fbsd and linux
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@999 726aef4b-f618-498e-8847-2d620e286838
2008-04-01 00:22:43 +00:00
imaginos 1fb0039732 reverse the order of dns lookup on bind vs dns lookup on remote host. this also does a check on each ip returned by getaddrinfo to be sure its able to connect to that host
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@994 726aef4b-f618-498e-8847-2d620e286838
2008-03-28 05:09:48 +00:00
psychon be3edeee82 Update to latest Csocket
This fixes some trailing whitespaces and space/tab mixups I found.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@958 726aef4b-f618-498e-8847-2d620e286838
2008-02-16 12:50:07 +00:00
psychon c6664d5ab9 Update to latest Csocket
This is some stuff I wrote:
- sockets are marked as close-on-exec so that child processes (e.g. from the
  shell module) don't get a copy of all of our sockets.
- This adds separate functions for marking sockets as blocking / non-blocking.
- When a socket is marked for closing, we stop reading lines from it.

I don't think any of these two bugs were actually ever triggered by anyone,
but meh, so what?


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@941 726aef4b-f618-498e-8847-2d620e286838
2008-02-07 17:22:36 +00:00
psychon b5e6518fdc Again, update to latest Csocket
I wonder how often I did this kind of commit already...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@923 726aef4b-f618-498e-8847-2d620e286838
2008-01-17 22:44:12 +00:00
psychon 4c5d81b2a3 Csocket again
<@x-x> psychon: merge new csocket :>


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@866 726aef4b-f618-498e-8847-2d620e286838
2007-11-10 22:25:51 +00:00
psychon 6605c7fb7a Update to latest Csocket version (how often did I do this already?)
This time it fixes ZNC on BSD* (netbsd and openbsd were reported, only netbsd
tested, but well :) ).

We used an illegal select timeout (tv_usec bigger than 999999).



git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@863 726aef4b-f618-498e-8847-2d620e286838
2007-11-06 19:07:10 +00:00
psychon 2503cd9d37 Update Csocket (I feel like half my commits start like this -.-)
DynamicSelectLoop had a bug causing it to always use the lower bound making it
effectively useless. Now it's useful again :)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@859 726aef4b-f618-498e-8847-2d620e286838
2007-11-03 19:52:27 +00:00
psychon babc0f9f8b Update Csocket
This fixes building with --disable-openssl


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@858 726aef4b-f618-498e-8847-2d620e286838
2007-11-02 08:37:35 +00:00
psychon 52534f2d1f Update Csocket
This fixes an unimportant leak (if ReadBuf or ReadLine returned by throwing an
exception a 4k buffer was leaked).
We only triggered this if we were shutting down and thus this leak is
unimportant to us.

Also remove the svn:keywords property from Csocket.h and .cpp so the $Revision$
strings from upstream aren't changed.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@854 726aef4b-f618-498e-8847-2d620e286838
2007-10-26 11:06:05 +00:00
psychon b63b7d03d8 Updated to latest Csocket version which includes a fix for NetBSD 3.*
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@837 726aef4b-f618-498e-8847-2d620e286838
2007-09-04 15:12:22 +00:00
psychon 9736711c03 Update to latest CSocket version.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@823 726aef4b-f618-498e-8847-2d620e286838
2007-08-07 22:58:23 +00:00
imaginos 9541fa2492 fix ssl dependency
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@789 726aef4b-f618-498e-8847-2d620e286838
2007-01-20 20:22:04 +00:00
imaginos 2bbdb72a97 setup to only call time() if a cron is actually in use, also fix copy.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@788 726aef4b-f618-498e-8847-2d620e286838
2007-01-20 12:10:26 +00:00