aboutsummaryrefslogtreecommitdiff
path: root/src/or/hibernate.c
AgeCommit message (Collapse)Author
2017-08-01Merge branch 'maint-0.2.9' into maint-0.3.0Nick Mathewson
2017-08-01Merge remote-tracking branch 'public/bug22245_024' into maint-0.2.9Nick Mathewson
2017-05-15Fix a logic error in hibernate.cNick Mathewson
Closes bug 22245; bugfix on 0.0.9rc1, when bandwidth accounting was first introduced. Found by Andrey Karpov and reported at https://www.viva64.com/en/b/0507/
2016-12-12Replace "people" with the appropriate network component in commentsJ. Ryan Stinnett
Fixes #18145.
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-08-31Don't warn on unlink(bw_accounting) when errno == ENOENTNick Mathewson
Patch from pastly; fixes bug 19964.
2016-06-11Add -Wmissing-variable-declarations, with attendant fixesNick Mathewson
This is a big-ish patch, but it's very straightforward. Under this clang warning, we're not actually allowed to have a global variable without a previous extern declaration for it. The cases where we violated this rule fall into three roughly equal groups: * Stuff that should have been static. * Stuff that was global but where the extern was local to some other C file. * Stuff that was only global when built for the unit tests, that needed a conditional extern in the headers. The first two were IMO genuine problems; the last is a wart of how we build tests.
2016-03-30Issue a `STATUS_SERVER` event on meaningful hibernation state changes.Yawning Angel
Implements feature #18685.
2016-02-27Update the copyright year.Nick Mathewson
2016-01-08Added AccountRule in and AccountingRule out optionsunixninja92
2015-12-15Replace usage of INLINE with inlinecypherpunks
This patch was generated using; sed -i -e "s/\bINLINE\b/inline/" src/*/*.[ch] src/*/*/*.[ch]
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick 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-09-29Avoid frequent strcmp() calls for AccountingRuleNick Mathewson
Generally, we don't like to parse the same thing over and over; it's best IMO to do it once at the start of the code.
2014-09-29Add an "AccountingRule" feature to permit limiting bw usage by read+writeNick Mathewson
Patch from "chobe". Closes ticket 961.
2014-04-15Uplift status.c unit test coverage with new test cases and macros.dana koch
A new set of unit test cases are provided, as well as introducing an alternative paradigm and macros to support it. Primarily, each test case is given its own namespace, in order to isolate tests from each other. We do this by in the usual fashion, by appending module and submodule names to our symbols. New macros assist by reducing friction for this and other tasks, like overriding a function in the global namespace with one in the current namespace, or declaring integer variables to assist tracking how many times a mock has been called. A set of tests for a small-scale module has been included in this commit, in order to highlight how the paradigm can be used. This suite gives 100% coverage to status.c in test execution.
2014-03-31Always check returns from unlink()Andrea Shepard
2013-08-21Tweak/cleanup 5526 fix.Nick Mathewson
2013-08-21Print accounting information in heartbeat messages.Peter Retzlaff
Implements ticket 5526.
2013-07-10Completely refactor how FILENAME_PRIVATE worksNick Mathewson
We previously used FILENAME_PRIVATE identifiers mostly for identifiers exposed only to the unit tests... but also for identifiers exposed to the benchmarker, and sometimes for identifiers exposed to a similar module, and occasionally for no really good reason at all. Now, we use FILENAME_PRIVATE identifiers for identifiers shared by Tor and the unit tests. They should be defined static when we aren't building the unit test, and globally visible otherwise. (The STATIC macro will keep us honest here.) For identifiers used only by the unit tests and never by Tor at all, on the other hand, we wrap them in #ifdef TOR_UNIT_TESTS. This is not the motivating use case for the split test/non-test build system; it's just a test example to see how it works, and to take a chance to clean up the code a little.
2013-02-23Remove a bunch of unused macro definitionsNick Mathewson
2013-01-16Update the copyright date to 201.Nick Mathewson
2012-11-23In comments and logs, say "UTC" not "GMT"Nick Mathewson
Fix for #6113. Note that the RFC1123 times we generate still all say 'GMT'. I'm going to suggest this is not worth changing.
2012-11-13Call channel_mark_for_close() properly in hibernate_go_dormant()Andrea Shepard
2012-09-13Split the or_state_t portions of config.c into their own fileNick Mathewson
2012-06-04Update copyright dates to 2012; add a few missing copyright statementsNick Mathewson
2012-06-04Add about 60 more DOCDOC comments to 0.2.3Nick Mathewson
Also, try to resolve some doxygen issues. First, define a magic "This is doxygen!" macro so that we take the correct branch in various #if/#else/#endifs in order to get the right documentation. Second, add in a few grouping @{ and @} entries in order to get some variables and fields to get grouped together.
2012-01-18Rename nonconformant identifiers.Nick Mathewson
Fixes bug 4893. These changes are pure mechanical, and were generated with this perl script: /usr/bin/perl -w -i.bak -p s/crypto_pk_env_t/crypto_pk_t/g; s/crypto_dh_env_t/crypto_dh_t/g; s/crypto_cipher_env_t/crypto_cipher_t/g; s/crypto_digest_env_t/crypto_digest_t/g; s/aes_free_cipher/aes_cipher_free/g; s/crypto_free_cipher_env/crypto_cipher_free/g; s/crypto_free_digest_env/crypto_digest_free/g; s/crypto_free_pk_env/crypto_pk_free/g; s/_crypto_dh_env_get_dh/_crypto_dh_get_dh/g; s/_crypto_new_pk_env_rsa/_crypto_new_pk_from_rsa/g; s/_crypto_pk_env_get_evp_pkey/_crypto_pk_get_evp_pkey/g; s/_crypto_pk_env_get_rsa/_crypto_pk_get_rsa/g; s/crypto_new_cipher_env/crypto_cipher_new/g; s/crypto_new_digest_env/crypto_digest_new/g; s/crypto_new_digest256_env/crypto_digest256_new/g; s/crypto_new_pk_env/crypto_pk_new/g; s/crypto_create_crypto_env/crypto_cipher_new/g; s/connection_create_listener/connection_listener_new/g; s/smartlist_create/smartlist_new/g; s/transport_create/transport_new/g;
2012-01-16Convert instances of tor_malloc+tor_snprintf into tor_asprintfNick Mathewson
These were found by looking for tor_snprintf() instances that were preceeded closely by tor_malloc(), though I probably converted some more snprintfs as well. (In every case, make sure that the length variable (if any) is removed, renamed, or lowered, so that anything else that might have assumed a longer buffer doesn't exist.)
2012-01-10Advertise dirport if accountingmax is large enoughSebastian Hahn
When we have an effective bandwidthrate configured so that we cannot exceed our bandwidth limit in one accounting interval, don't disable advertising the dirport. Implements ticket 2434.
2011-11-28New 'DisableNetwork' option to prevent Tor from using the networkNick Mathewson
Some controllers want this so they can mess with Tor's configuration for a while via the control port before actually letting Tor out of the house. We do this with a new DisableNetwork option, that prevents Tor from making any outbound connections or binding any non-control listeners. Additionally, it shuts down the same functionality as shuts down when we are hibernating, plus the code that launches directory downloads. To make sure I didn't miss anything, I added a clause straight to connection_connect, so that we won't even try to open an outbound socket when the network is disabled. In my testing, I made this an assert, but since I probably missed something, I've turned it into a BUG warning for testing.
2011-10-28Merge remote-tracking branch 'origin/maint-0.2.2'Nick Mathewson
2011-10-28Fix typo, spotted by tmpname0901. Thanks!Sebastian Hahn
2011-10-11Fix a bunch of whitespace errorsNick Mathewson
2011-10-07Merge remote-tracking branch 'public/bug2003_nm'Nick Mathewson
2011-09-07Make the unit tests pass again after the bug2003 fixNick Mathewson
2011-09-01Don't update AccountingSoftLimitHitAt on startupSebastian Hahn
Add a "default" state which we use until we've decided whether we're live or hibernating. This allows us to properly track whether we're resuming a hibernation period or not. Fixes bug 2003.
2011-07-21Move entry-only fields from edge_connection_t to entry_connection_tNick Mathewson
Also, refactor the code accordingly.
2011-06-14Make the get_options() return constNick Mathewson
This lets us make a lot of other stuff const, allows the compiler to generate (slightly) better code, and will make me get slightly fewer patches from folks who stick mutable stuff into or_options_t. const: because not every input is an output!
2011-04-29Correctly check elapsed time in last hibernation periodSebastian Hahn
Fix bug 3020.
2011-01-25Log more about soft-hibernationNick Mathewson
2011-01-03Merge remote branch 'origin/maint-0.2.1' into maint-0.2.2Nick Mathewson
Conflicts: src/common/test.h src/or/test.c
2011-01-03Bump copyright statements to 2011Nick Mathewson
2010-12-06Fix a bug in calculating wakeup time on 64-bit machines.Nick Mathewson
If you had TIME_MAX > INT_MAX, and your "time_to_exhaust_bw = accountingmax/expected_bandwidth_usage * 60" calculation managed to overflow INT_MAX, then your time_to_consider value could underflow and wind up being rediculously low or high. "Low" was no problem; negative values got caught by the (time_to_consider <= 0) check. "High", however, would get you a wakeup time somewhere in the distant future. The fix is to check for time_to_exhaust_bw overflowing INT_MAX, not TIME_MAX: We don't allow any accounting interval longer than a month, so if time_to_exhaust_bw is significantly larger than 31*24*60*60, we can just clip it. This is a bugfix on 0.0.9pre6, when accounting was first introduced. It fixes bug 2146, unless there are other causes there too. The fix is from boboper. (I tweaked it slightly by removing an assignment that boboper marked as dead, and lowering a variable that no longer needed to be function-scoped.)
2010-12-03Don't crash when accountingmax is set in non-server TorsNick Mathewson
We use a hash of the identity key to seed a prng to tell when an accounting period should end. But thanks to the bug998 changes, clients no longer have server-identity keys to use as a long-term seed in accounting calculations. In any case, their identity keys (as used in TLS) were never never fixed. So we can just set the wakeup time from a random seed instead there. Still open is whether everybody should be random. This patch fixes bug 2235, which was introduced in 0.2.2.18-alpha. Diagnosed with help from boboper on irc.
2010-10-04Maintain separate server and client identity keys when appropriate.Robert Ransom
Fixes a bug described in ticket #988.
2010-09-23Merge branch 'bug1511'Nick Mathewson
2010-09-21Even more accurate handling for shifting accounting intervalsNick Mathewson
Roger correctly pointed out that my code was broken for accounting periods that shifted forwards, since start_of_accounting_period_containing(interval_start_time) would not be equal to interval_start_time, but potentially much earlier.
2010-09-21Bug1789 cleanups suggested by armaNick Mathewson
The significant one is that we look at RelayBandwidthRate if it is set.
2010-09-15finish a comment, lower a variableNick Mathewson