summaryrefslogtreecommitdiff
path: root/src/or/cpuworker.c
AgeCommit message (Collapse)Author
2018-02-07more fixes for typos, grammar, whitespace, etcRoger Dingledine
some of these ought to have been noticed by the "misspell" tool, so if anybody is debugging it, here are some bug reports :)
2017-12-08Convert remaining function (mostly static) to new free styleNick Mathewson
2017-07-27Merge branch 'maint-0.3.1'Nick Mathewson
2017-07-27Fix the cpuworker.c documentation to mention all the kinds of workNick Mathewson
2017-07-27Always start with one additional worker threadNick Mathewson
Now that half the threads are permissive and half are strict, we need to make sure we have at least two threads, so that we'll have at least one of each kind.
2017-07-27Queue consensus diffs at LOW priority.Nick Mathewson
Fixes bug 22883.
2017-07-07Explicit length checks in circuit_init_cpath_crypto().George Kadianakis
2017-06-21make assign_onionskin_to_cpuworker failure case more clearRoger Dingledine
now it looks like the other time we call it
2017-06-21Merge branch 'bug22356_029' into maint-0.3.1Nick Mathewson
2017-06-19Downgrade "assign_to_cpuworker failed" to INFO.Nick Mathewson
Closes ticket 22356
2017-04-24Make cpuworker_queue_work function mockable.Nick Mathewson
I'll be using this in the unit tests for consdiffmgr.
2017-04-15Expand cpuworker API to allow other work typesNick Mathewson
2017-03-15Run the copyright update script.Nick Mathewson
2016-10-31Actually free the worker_state_t object when we do an update with itNick Mathewson
Previously we freed the old "keys" object, but leaked the worker_state_t that we had taken it from. Fixes bug 20401; bugfix on 0.2.6.3-alpha.
2016-10-17Write a bunch of module documentation.Nick Mathewson
This commit adds or improves the module-level documenation for: buffers.c circuitstats.c command.c connection_edge.c control.c cpuworker.c crypto_curve25519.c crypto_curve25519.h crypto_ed25519.c crypto_format.c dircollate.c dirserv.c dns.c dns_structs.h fp_pair.c geoip.c hibernate.c keypin.c ntmain.c onion.c onion_fast.c onion_ntor.c onion_tap.c periodic.c protover.c protover.h reasons.c rephist.c replaycache.c routerlist.c routerparse.c routerset.c statefile.c status.c tor_main.c workqueue.c In particular, I've tried to explain (for each documented module) what each module does, what's in it, what the big idea is, why it belongs in Tor, and who calls it. In a few cases, I've added TODO notes about refactoring opportunities. I've also renamed an argument, and fixed a few DOCDOC comments.
2016-07-04Raise libevent dependency to 2.0.10-stable or newerSebastian Hahn
Only some very ancient distributions don't ship with Libevent 2 anymore, even the oldest supported Ubuntu LTS version has it. This allows us to get rid of a lot of compat code.
2016-02-27Update the copyright year.Nick Mathewson
2015-08-21Ensure worker threads actually exit when it is timeSebastian Hahn
This includes a small refactoring to use a new enum (workqueue_reply_t) for the return values instead of just ints.
2015-03-12add an explanatory commentNick Mathewson
2015-03-12Also, add an assertion to assign_onionskin_to_cpuworkerNick Mathewson
2015-03-12Fix crash bug when calling cpuworkers_rotate_keyinfo on a client.Nick Mathewson
Fixes bug 15245; bugfix on 0.2.6.3-alpha. Thanks to anonym for reporting!
2015-02-16Fix a few coverity "Use after NULL check" warningsNick Mathewson
Also remove the unit test mocks that allowed get_options() to be NULL; that's an invariant violation for get_options().
2015-02-15Call cpu_init if we change to being a relaySebastian Hahn
The issue is that we use the cpuworker system with relays only, so if we start up as a client and transition to being a relay later, we'll be sad. This fixes bug 14901; not in any released version of Tor.
2015-02-09Add some comments to or_circuit_t.workqueue_entrySebastian Hahn
These were suggested by dgoulet, thanks!
2015-02-09Avoid use-after-free of circ belonging to cancelled jobSebastian Hahn
This fixes a bug where we decide to free the circuit because it isn't on any workqueue anymore, and then the job finishes and the circuit gets freed again. Fixes bug #14815, not in any released version of Tor.
2015-02-05Fix a work-counting bug introduced by the workqueue mergeNick Mathewson
David Goulet finds that when he runs a busy relay for a while with the latest version of the git code, the number of onionskins handled slowly dwindles to zero, with total_pending_tasks wedged at its maximum value. I conjecture this is because the total_pending_tasks variable isn't decremented when we successfully cancel a job. Fixed that. Fixes bug 14741; bugfix not on any released version of tor.
2015-01-26Bail early in cpuworker_onion_handshake_replyfn if the circuit is markedNick Mathewson
2015-01-23whitespace fixesNick Mathewson
2015-01-21Fix: remove whitespace and update a comment in cpuworker.cDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-01-15Update workqueue implementation to use a single queue for the workNick Mathewson
Previously I used one queue per worker; now I use one queue for everyone. The "broadcast" code is gone, replaced with an idempotent 'update' operation.
2015-01-14Avoid chan/circ linear lookups for requestsNick Mathewson
The solution I took is to not free a circuit with a pending uncancellable work item, but rather to set its magic number to a sentinel value. When we get a work item, we check whether the circuit has that magic sentinel, and if so, we free it rather than processing the reply.
2015-01-14Remove if (1) indentation in cpuworker.cNick Mathewson
To avoid having diffs turn out too big, I had replaced some unneeded ifs and fors with if (1), so that the indentation would still work out right. Now I might as well clean those up.
2015-01-14Refactor cpuworker to use workqueue/threadpool code.Nick Mathewson
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick Mathewson
2014-11-02Apply new calloc coccinelle patchNick Mathewson
2014-10-28Add another year to our copyright dates.Nick Mathewson
Because in 95 years, we or our successors will surely care about enforcing the BSD license terms on this code. Right?
2014-08-13Apply coccinelle script to replace malloc(a*b)->calloc(a,b)Nick Mathewson
2014-06-20Thread support is now requiredNick Mathewson
Long ago we supported systems where there was no support for threads, or where the threading library was broken. We shouldn't have do that any more: on every OS that matters, threads exist, and the OS supports running threads across multiple CPUs. This resolves tickets 9495 and 12439. It's a prerequisite to making our workqueue code work better, since sensible workqueue implementations don't split across multiple processes.
2014-05-01Merge remote-tracking branch 'public/bug4345a_024'Nick Mathewson
2014-04-18scan-build: in cpuworker, initialize tv_startNick Mathewson
scan-build doesn't realize that a request can't be timed at the end unless it's timed at the start, and so it's not possible for us to be subtracting start from end without start being set. Nevertheless, let's not confuse it.
2014-03-27Renamed "onionskins_completed" to "onionskins_assigned"Nick Mathewson
This improves the accuracy of the function/variable names.
2014-01-17Check spawn_func() return valueNick Mathewson
If we don't, we can wind up with a wedged cpuworker, and write to it for ages and ages. Found by skruffy. This was a bug in 2dda97e8fd898757, a.k.a. svn revision 402. It's been there since we have been using cpuworkers.
2013-09-05collect and log statistics about onionskins received/processedRoger Dingledine
we skip onionskins that came from non-relays, so we're less likely to run into privacy troubles. starts to implement ticket 9658.
2013-03-18Check return values from fcntl and setsockoptNick Mathewson
(Based on a patch from flupzor; bug #8206)
2013-03-10Fix 8447: use %u to format circid_t.Nick Mathewson
Now that circid_t is 4 bytes long, the default integer promotions will leave it alone when sizeof(int) == 4, which will leave us formatting an unsigned as an int. That's technically undefined behavior. Fixes bug 8447 on bfffc1f0fc7616a25c32da2eb759dade4651659e. Bug not in any released Tor.
2013-02-15Merge remote-tracking branch 'public/wide_circ_ids'Nick Mathewson
Conflicts: src/or/channel.h src/or/connection_or.c src/or/cpuworker.c
2013-02-11Fix a nigh-impossible overflow in cpuworker.cNick Mathewson
When we compute the estimated microseconds we need to handle our pending onionskins, we could (in principle) overflow a uint32_t if we ever had 4 million pending onionskins before we had any data about how onionskins take. Nevertheless, let's compute it properly. Fixes bug 8210; bugfix on 0.2.4.10. Found by coverity; this is CID 980651.
2013-02-08Fix numerous problems with Tor's weak RNG.Nick Mathewson
We need a weak RNG in a couple of places where the strong RNG is both needless and too slow. We had been using the weak RNG from our platform's libc implementation, but that was problematic (because many platforms have exceptionally horrible weak RNGs -- like, ones that only return values between 0 and SHORT_MAX) and because we were using it in a way that was wrong for LCG-based weak RNGs. (We were counting on the low bits of the LCG output to be as random as the high ones, which isn't true.) This patch adds a separate type for a weak RNG, adds an LCG implementation for it, and uses that exclusively where we had been using the platform weak RNG.
2013-01-24Merge branch 'time_based_onionqueue_v2' of ssh://git-rw.torproject.org/nickm/torAndrea Shepard
2013-01-16Update the copyright date to 201.Nick Mathewson