Commit Graph

153 Commits

Author SHA1 Message Date
Nick Mathewson
f3eaeb99a3 r18051@catbus: nickm | 2008-02-12 15:20:43 -0500
Re-tune mempool parametes based on testing on peacetime: use smaller chuncks, free them a little more aggressively, and try very hard to concentrate allocations on fuller chunks.  Also, lots of new documentation.


svn:r13484
2008-02-12 20:20:52 +00:00
Nick Mathewson
842a33ff20 Update some copyright notices: it is now 2008.
svn:r13412
2008-02-07 05:31:47 +00:00
Nick Mathewson
ac69319d3f r17899@catbus: nickm | 2008-02-05 14:14:06 -0500
Fix a couple of XXX020 items. Also, disable all "condition" sychronization code, since Tor does not use it yet


svn:r13380
2008-02-05 19:40:19 +00:00
Nick Mathewson
54029559d7 Apparently, our windows code for detecting ipv6 structures has worked for a while. Remove the special-case, remove the related XXXX020s, and add useful comments instead.
svn:r13377
2008-02-05 19:36:06 +00:00
Nick Mathewson
6d58d80e78 r17472@catbus: nickm | 2008-01-05 22:10:19 -0500
Another test for the increasingly bad check-spaces style checker to check: #else\n#if is almost a sure sign of a failure to use #elif.  Fortunately, we only did that 3 times.


svn:r13039
2008-01-06 03:16:08 +00:00
Roger Dingledine
1d8a8063b9 clean up copyrights, and assign 2007 copyrights to The Tor Project, Inc
svn:r12786
2007-12-12 21:09:01 +00:00
Nick Mathewson
bd49bba49e r17091@catbus: nickm | 2007-12-11 18:05:55 -0500
Fix compilation when --disable-threads is passed in.


svn:r12768
2007-12-11 23:06:51 +00:00
Nick Mathewson
f948caad7b r15161@tombo: nickm | 2007-12-05 11:30:37 -0500
Fix bug reported by Steve Murphy on or-talk: detect the s6_addr32 and s6_addr16 fields via autoconf.


svn:r12679
2007-12-05 16:30:52 +00:00
Nick Mathewson
593ab7e808 r15106@tombo: nickm | 2007-12-04 00:08:35 -0500
Change tor_addr_t to be a tagged union of in_addr and in6_addr, not of sockaddr_in and sockaddr_in6.  It's hardly used in the main code as it is, but let's get it right before it gets popular.


svn:r12660
2007-12-04 05:19:56 +00:00
Nick Mathewson
42172829ce r16016@catbus: nickm | 2007-10-21 20:44:19 -0400
Check a platform assumption we have made without checking for too long: "Characters are represented in ascii."


svn:r12088
2007-10-22 00:44:42 +00:00
Nick Mathewson
a237f25f9a r14651@catbus: nickm | 2007-08-17 21:37:03 -0400
Another attempt to confirm to msvc for bug 482.


svn:r11162
2007-08-18 01:38:11 +00:00
Nick Mathewson
1f244d3943 r14639@catbus: nickm | 2007-08-17 17:45:28 -0400
Compile without warnings on MinGW, even with --enable-gcc-warnings enabled.


svn:r11157
2007-08-17 21:46:34 +00:00
Nick Mathewson
f8b3927e07 r14634@catbus: nickm | 2007-08-17 16:43:49 -0400
Try to fix bug 482: do not rely on s6_addr16 or s6_addr32 on MSVC.  How ugly.


svn:r11155
2007-08-17 20:44:54 +00:00
Nick Mathewson
ba28346f2f r13907@Kushana: nickm | 2007-08-02 10:29:13 -0700
Try (once again) to fix mingw build wrt detecting ipv6 types.


svn:r11037
2007-08-02 17:30:42 +00:00
Nick Mathewson
484c8b776d r13872@Kushana: nickm | 2007-07-31 08:27:54 -0700
Rename IN4_ADDR and IN6_ADDR to try to avoid conflicting with Windows definitions.  This may fix the windows build.


svn:r11011
2007-08-01 15:57:34 +00:00
Nick Mathewson
25bd4204d0 r13964@catbus: nickm | 2007-07-28 22:55:10 -0400
Change "IN_ADDR" macro to "IN4_ADDR" in an attempt to fix mingw compilation


svn:r10963
2007-07-29 02:55:24 +00:00
Nick Mathewson
189bc7cf9f r13920@catbus: nickm | 2007-07-26 16:25:25 -0400
whitespace fixes


svn:r10935
2007-07-26 20:26:53 +00:00
Nick Mathewson
a1f4644a94 r13840@catbus: nickm | 2007-07-19 16:00:43 -0400
Apparently, this problem can occur on the whole BSD family. "Yay."


svn:r10884
2007-07-19 20:00:45 +00:00
Nick Mathewson
b2772f93cb r13838@catbus: nickm | 2007-07-19 15:50:16 -0400
Apparently, OSX does not define s6_addr32 or s6_addr16. How silly.


svn:r10883
2007-07-19 19:50:20 +00:00
Nick Mathewson
bbbf504281 r13827@catbus: nickm | 2007-07-19 14:42:25 -0400
Merge in some generic address manipulation code from croup.  Needs some work.


svn:r10880
2007-07-19 18:46:09 +00:00
Nick Mathewson
ae4ab0f617 r13454@kushana: nickm | 2007-06-20 14:22:44 -0400
Switch windows locking implementation to CRITICAL_SECTION, not Mutex: Mutex is heavier-weight, and meant for multi-process situations.


svn:r10739
2007-07-05 14:51:01 +00:00
Nick Mathewson
1bdcfd9203 r13570@catbus: nickm | 2007-06-30 20:41:05 -0400
Implement conditions in compat.c; switch windows to use "critical sections" instead of mutexes.  Apparently, mutexes are for IPC and critical sections are for multithreaded.


svn:r10716
2007-07-01 16:22:45 +00:00
Nick Mathewson
5adfa09fce r13477@catbus: nickm | 2007-06-17 14:22:03 -0400
Sun CC likes to give warnings for the do { } while(0) construction for making statement-like macros.  Define STMT_BEGIN/STMT_END macros that do the right thing, and use them everywhere.


svn:r10645
2007-06-17 18:22:39 +00:00
Nick Mathewson
71c0a13703 r13110@catbus: nickm | 2007-05-31 15:03:24 -0400
Fix windows build.


svn:r10424
2007-05-31 19:03:46 +00:00
Nick Mathewson
bb524e99c9 r12955@catbus: nickm | 2007-05-25 13:17:30 -0400
First bare stubs of ipv6 work: commit some (untested, hence doublessly broken) implementations of inet_ntop/pton for systems that lack them.


svn:r10326
2007-05-25 18:22:37 +00:00
Nick Mathewson
d3d86b17a7 r12916@catbus: nickm | 2007-05-24 12:43:45 -0400
Add math functions to round values to the nearest power of 2.  Make mempools more careful about making sure that the size of their chunks is a little less than a power of 2, not a little more.


svn:r10304
2007-05-24 17:12:57 +00:00
Nick Mathewson
4ec5e139c8 r12850@catbus: nickm | 2007-05-21 22:20:42 -0400
Partial backport candidate: do not rely on finding a \0 after an mmaped() router/extrainfo file.  Also, set journal length correctly when starting up.


svn:r10248
2007-05-22 02:20:52 +00:00
Nick Mathewson
e043b86f47 r12764@catbus: nickm | 2007-05-15 17:17:39 -0400
Enable (and cope with) more GCC 4.2 warnings.


svn:r10196
2007-05-15 21:17:48 +00:00
Nick Mathewson
227b2e0226 r12759@Kushana: nickm | 2007-04-20 08:47:20 -0400
Track the number of connection_t separately from the number of open sockets.  It is already possible to have connections that do not count: resolving conns, for one.  Once we move from socketpairs to linked conns, and once we do dns proxying, there will be lots of such connections.


svn:r9994
2007-04-21 17:24:18 +00:00
Nick Mathewson
d62e37b4a9 r12473@Kushana: nickm | 2007-03-06 15:49:45 -0500
Excise PREDICT and PREDICT_FALSE in favor of PREDICT_LIKELY and PREDICT_UNLIKELY.


svn:r9781
2007-03-09 21:39:19 +00:00
Nick Mathewson
5d1bee87ff r12468@Kushana: nickm | 2007-03-06 15:24:00 -0500
More unit tests: gcov is fun.


svn:r9748
2007-03-06 20:25:44 +00:00
Nick Mathewson
e2b1a77c3e r12006@catbus: nickm | 2007-02-28 16:06:24 -0500
On mingw, use "%I64u" to printf/scanf 64-bit integers, instead of the usual GCC "%llu".  This prevents a bug when saving 64-bit int configuration values on mingw; the high-order 32 bits would get truncated.  If the value was then reloaded, disaster would occur. (Fixes bug 400 and maybe also bug 397.)  Backport candidate.


svn:r9691
2007-02-28 21:07:19 +00:00
Nick Mathewson
dfbced7499 r11998@catbus: nickm | 2007-02-28 13:56:55 -0500
Correct an MSC_VER check.


svn:r9685
2007-02-28 18:57:03 +00:00
Nick Mathewson
e1176ece5a r11992@catbus: nickm | 2007-02-28 12:46:32 -0500
compile fix on mingw: mingw does not define _MSC_VER.


svn:r9682
2007-02-28 17:46:36 +00:00
Nick Mathewson
759c58151e r11775@catbus: nickm | 2007-02-12 16:39:09 -0500
Update copyright dates.


svn:r9570
2007-02-12 21:39:53 +00:00
Nick Mathewson
30e7c05075 r11774@catbus: nickm | 2007-02-12 16:31:47 -0500
Handle errors on opening cached-routers* more uniformly and sanely: log not-found errors at level INFO, and all other errors at level WARN.  Needs testing on win32.


svn:r9569
2007-02-12 21:39:44 +00:00
Nick Mathewson
76f896e714 r11607@catbus: nickm | 2007-01-30 17:19:27 -0500
Audit non-const char arguments; make a lot more of them const.


svn:r9466
2007-01-30 22:19:41 +00:00
Nick Mathewson
50771a6b48 r9380@Kushana: nickm | 2006-10-24 21:25:07 -0400
Add string.h include to compat.h so that strlcpy() and strlcat() will always be defined after including compat.h.  This should resolve warnings on centos.


svn:r8824
2006-10-25 01:25:17 +00:00
Nick Mathewson
7551c44a53 r9274@Kushana: nickm | 2006-10-19 16:16:58 -0400
Add unit tests for tor_mmap_file(); make tor_mmap_t.size always be the size of the file (not the size of the mapping); add an extra argument to read_file_to_str() so it can return the size of the result string.


svn:r8762
2006-10-19 23:05:02 +00:00
Nick Mathewson
93beeac01d Merge in some bsockets calls, all wrapped inside #if defined(USE_BSOCKETS)
svn:r8427
2006-09-19 20:41:31 +00:00
Nick Mathewson
000b7b287c r8724@Kushana: nickm | 2006-09-06 04:32:28 -0400
Fix spaces; restore support for mapping files over 4GB on win32 (?)


svn:r8326
2006-09-06 08:42:16 +00:00
Mike Chiussi
6ec9c1092a - made configure check if we are building for win32
- made configure link to required system dll's if building for win32
- added diffs for libevent 1.1b
- forced user to turn off eventdns if win32 is set 
- cleaned up tor_mmap_file()_win32 (not sure if it's stable)
- cleaned up some warnings and typos




svn:r8322
2006-09-06 01:49:55 +00:00
Nick Mathewson
f170e5798f r8692@Kushana: nickm | 2006-08-31 13:38:07 -0400
Fix bug 327 (part 2): Cast char to unsigned char before passing to toupper/tolower.  (Follow the same idiom as with isupper and friends, in case we run into the same problem on SGI or whereever it was.)


svn:r8310
2006-08-31 17:39:51 +00:00
Nick Mathewson
bc0c39f85d r8691@Kushana: nickm | 2006-08-31 13:30:46 -0400
Fix bug 327 (part 1): Use correct macro to test for GCC 3 or later.


svn:r8309
2006-08-31 17:39:47 +00:00
Nick Mathewson
fee33d2ff1 r8682@Kushana: nickm | 2006-08-29 17:58:59 -0400
Fix compilation on GCC2 by disabling fun attributes unless __GNUC_MAJOR__ >= 3.


svn:r8303
2006-08-29 21:59:20 +00:00
Nick Mathewson
6fcdcc7fc7 r8626@Kushana: nickm | 2006-08-27 23:45:46 -0400
Aw, crap.  Non-gcc bug.  We need regular windows builds.


svn:r8259
2006-08-28 03:46:21 +00:00
Nick Mathewson
ffab3b48a8 r7326@Kushana: nickm | 2006-08-10 23:50:49 -0700
And another GCC change: predict that tor_frees() are usually real frees, and tor_asserts() usually wont happen. Other test should wait till -fprofile-arcs


svn:r7022
2006-08-11 07:09:35 +00:00
Nick Mathewson
09a895e222 r7324@Kushana: nickm | 2006-08-10 23:23:15 -0700
Add more warnings to the list of those we tolerate. Start using GCC attributes more, for better error checking and better code generation.


svn:r7020
2006-08-11 07:09:17 +00:00
Nick Mathewson
7c596c166b r7029@Kushana: nickm | 2006-08-04 14:08:41 -0700
Remove now-spurious size and data arguments from tor_mmap_file


svn:r6987
2006-08-05 17:53:21 +00:00
Nick Mathewson
dbac3fb481 r7028@Kushana: nickm | 2006-08-04 13:10:16 -0700
Make data and size fields visible in tor_mmap_t; hide win magic differently.


svn:r6986
2006-08-05 17:53:08 +00:00
Nick Mathewson
bf72878cad r7012@Kushana: nickm | 2006-08-03 19:21:25 -0700
Add an "mmap handle" type to encapsulate bookkeeping elements of mmap issues; add prelim win32 impl


svn:r6980
2006-08-04 18:32:43 +00:00
Nick Mathewson
3843b1b3d0 r6978@Kushana: nickm | 2006-07-31 13:16:14 -0400
Add isupper and islower wrappers to compat.h


svn:r6957
2006-07-31 18:01:22 +00:00
Nick Mathewson
08a4114abf Another MSVC6 fix. Grnk.
svn:r6802
2006-07-21 14:53:23 +00:00
Nick Mathewson
e572d5990c MSVC6 is apparently terrified of unnatural cross-breeding between uint64_t and double, and needs more persuasion than usual to cast one to the other. Issue identified by Frediano Ziglio; patch revised for minimal impact on non-MSVC6 compilers.
svn:r6768
2006-07-17 00:39:05 +00:00
Roger Dingledine
35e95d7783 minor fixes
svn:r6710
2006-07-04 03:25:07 +00:00
Roger Dingledine
45065f1466 simplify code now that libevent considers all sockets pollable.
what we really mean now is ">= 0", which is clearer to test for.


svn:r6543
2006-06-05 09:08:10 +00:00
Nick Mathewson
86da3e0a0a Patch based on post by Mike C to or-dev; special-case based on use of MSVC, rather than on MS_WINDOWS, so that mingw builds.
svn:r6523
2006-06-03 18:52:31 +00:00
Nick Mathewson
64d487a2d6 Add a basic mmap function, with a "fake-it" wrapper to do read_file_from_str instead. Based on code from Michael Mohr.
svn:r6510
2006-05-28 16:54:39 +00:00
Nick Mathewson
89a8411ace Throw out this UNALIGNED_INT_ACCESS_OK nonsense. Even where it works, it is often way way slower than doing the right thing. Backport candidate.
svn:r6473
2006-05-23 08:23:03 +00:00
Nick Mathewson
0f0e14c6e3 normalize whitespace.
svn:r6173
2006-03-17 04:43:37 +00:00
Nick Mathewson
0c132ee2a1 Instead of listing a set of compilers that prefers __func__ to __FUNCTION__, use autoconf. Also, prefer __func__ in our own code: __func__ is a C99 standard, whereas __FUNCTION__ is not. [Fixes bug 254.]
svn:r6144
2006-03-13 00:25:36 +00:00
Roger Dingledine
5f051574d5 Happy new year!
svn:r5949
2006-02-09 05:46:49 +00:00
Roger Dingledine
6f579deff4 check for EADDRINUSE in a cross-platform way (unless i'm wrong)
svn:r5899
2006-02-03 12:25:46 +00:00
Nick Mathewson
1af630d32c Bite the bullet and limit all our source lines to 80 characters, the way IBM intended.
svn:r5582
2005-12-14 20:40:40 +00:00
Roger Dingledine
130d0e4d1d fix typo noticed by scrimbly
svn:r5522
2005-12-07 19:49:18 +00:00
Nick Mathewson
932106f54c Efficiency hack: call tor_fix_source_file late, not early. Add "BUG" domain. Domains are now bitmasks... just in case. Make some err msgs non-general.
svn:r5309
2005-10-25 07:05:03 +00:00
Nick Mathewson
ba24193ab5 Make doxygen marginally happier
svn:r5208
2005-10-06 04:33:40 +00:00
Nick Mathewson
6973ef9be4 Add a touch_file() function to compat so we can update cache mtimes.
svn:r5067
2005-09-14 23:27:52 +00:00
Nick Mathewson
d26523e089 Use tor_listdir in test.c instead of duplicating ode.
svn:r4981
2005-09-10 01:42:42 +00:00
Nick Mathewson
789374dbbd Make GCC very happy, even with lots of warnings set. Also, try to fix some reported Solaris x86 warnings.
svn:r4770
2005-08-12 17:24:53 +00:00
Roger Dingledine
cfd6514482 and a nearby define
svn:r4643
2005-07-23 02:19:43 +00:00
Nick Mathewson
b98e4a0cd7 add parenthesis to U64_PRINTF_ARG macro
svn:r4642
2005-07-23 02:12:40 +00:00
Nick Mathewson
5fee58adfb Add a tor_memmem function
svn:r4452
2005-06-18 02:17:11 +00:00
Nick Mathewson
0831823763 Change end-of-file NLNL convention. It turns out arma I and I agree.
svn:r4382
2005-06-09 19:03:31 +00:00
Nick Mathewson
ea5591ee4d Implement --disable-threads
svn:r4187
2005-05-10 20:02:52 +00:00
Nick Mathewson
10b2208d93 Make Tor compile with no warnings with gcc4.0 on OSX
svn:r4184
2005-05-07 05:55:06 +00:00
Nick Mathewson
0e81265359 update copyright notices.
svn:r3982
2005-04-01 20:15:56 +00:00
Nick Mathewson
0197b47ce9 Fix some more obscure compiler warnings
svn:r3758
2005-03-14 03:28:46 +00:00
Nick Mathewson
97dad670ea Renormalize whitespace
svn:r3757
2005-03-14 03:18:35 +00:00
Nick Mathewson
bbaa3c7792 Implement more control spec functionality
- Mapaddress
- Postdescriptor
- GetInfo on descriptors

Required changes elsewhere:
- Keep the most recent running_routers_t in the routerlist_t. That way we
  can learn about new routers and remember whether we were last told that
  they were up or down.  Also enables more simplifications.
- Keep the signed descriptor inside routerinfo_t.  This makes
  descriptor_entry_t in dirservers.c unneeded.
- Rename AddressMap (the verb) to MapAddress. Keep AddressMap as a noun.
- Check addresses for plausibility before mapping them.


svn:r3696
2005-02-25 20:46:13 +00:00
Roger Dingledine
55c3f15ed1 Forward-port the trick to bump up ConnLimit as far as it can
go, but not past MAXCONNECTIONS. Also throw away the FAKE_POLL
caveats since 0.1.0 doesn't need it any more.


svn:r3657
2005-02-22 23:52:44 +00:00
Nick Mathewson
70c3580f81 Patch to localtime/gmtime handling: use the _r variants where available. Use mutexes to fake _r where necessary. Make mutexes no-ops where no threading is enabled.
svn:r3653
2005-02-22 07:03:03 +00:00
Nick Mathewson
aac97a3c6a Tell openssl how to use locks and how to find thread ids -- this may prevent race conditions surrounding the error queue.
svn:r3622
2005-02-13 22:32:25 +00:00
Nick Mathewson
e4b21c97f7 Forward-port SGI Compatibility patches from Jan Schaumann
svn:r3517
2005-02-03 19:59:10 +00:00
Nick Mathewson
083b67cda5 Add rudimentary pthread support that needs more testing.
svn:r3439
2005-01-27 22:34:48 +00:00
Nick Mathewson
fbb7f869c5 fwd-port win32 isprint fix
svn:r3410
2005-01-22 00:42:58 +00:00
Nick Mathewson
324b192f68 Make Tor use Niels Provos's libevent instead of it's current
poll-but-sometimes-select mess.  This will let us use faster async cores
(like epoll, kpoll, and /dev/poll), and hopefully work better on Windows
too.

There are some fairly nasty changes to main.c here; this will almost
certainly break something.  But hey, that's what alphas are for.


svn:r3341
2005-01-12 06:42:32 +00:00
Nick Mathewson
ead52e0bdc Possible fix for task #43: when running on a multithreaded environment (currently only windows), threads should not close opposite sides of their socketpairs, and workers should not call connection_free_all(). This may fix win32 servers.
svn:r3247
2005-01-03 18:06:51 +00:00
Roger Dingledine
cf17d0d29c move network_init from or/main to common/compat
call network_init in tor-resolve.c too
move tor_lookup_hostname from common/util to common/compat


svn:r3203
2004-12-22 05:29:06 +00:00
Nick Mathewson
32978afa54 Workaround for brain-damaged __FILE__ handling on MSVC: keep Nick's name out
of the warning messages.


svn:r3199
2004-12-22 02:32:26 +00:00
Nick Mathewson
fe6eb34a10 Solaris CC freaks out if isspace and friends get anything other than an int. We learned that, so we casted. But it is also a bad idea to cast a signed char to an int and expect things to work on win32. Now we cast to unsigned char, then to int, then pass to isspace. Ug
svn:r3120
2004-12-08 00:42:50 +00:00
Nick Mathewson
7fbd297532 Suggestion from weasel: Make tor --version --version dump the cvs Id of every file.
svn:r3019
2004-11-29 22:25:31 +00:00
Nick Mathewson
32651dd108 connect() on win32 can do more things than we thought?
svn:r2999
2004-11-28 05:58:55 +00:00
Roger Dingledine
7c9a707900 remove emacs droppings, since nick says he doesn't need them anymore
svn:r2989
2004-11-26 04:00:55 +00:00
Nick Mathewson
22dba27d8d Normalize a few more kinds of whitespace. We now dislike:
- func (args)
  - if (x){
This doesn't normalize if(x), for(x); while(x), and friends.


svn:r2943
2004-11-22 23:28:26 +00:00
Nick Mathewson
8acaf8e187 Add "MEMUNIT" and "INTERVAL" types to configuration. Also tweak Accounting setup. More docs needed
svn:r2911
2004-11-20 00:37:00 +00:00
Nick Mathewson
8de9cfe184 Resolve FIXME items: make expand_filename handle ~ and ~username
svn:r2789
2004-11-10 14:23:31 +00:00
Nick Mathewson
b56ef496d9 Twiddle header order to compile on OS X again
svn:r2681
2004-11-04 22:33:20 +00:00
Nick Mathewson
3e16515343 The spelling is "d-e-f-i-n-e".
svn:r2650
2004-11-03 00:02:17 +00:00
Nick Mathewson
a2f6210b3e Add compatibility macros for printf and scanf-ing 64-bit unsigned ints
svn:r2648
2004-11-02 22:14:34 +00:00