aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
| * scripted-diff: Fully remove BOOST_FOREACHJorge Timón2017-06-051-34/+34
| | | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i 's/BOOST_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ; -END VERIFY SCRIPT-
* | Return early in IsBanned.Gregory Maxwell2017-06-091-18/+14
|/ | | | | I am not aware of any reason that we'd try to stop a ban-list timing side-channel and the prior code wouldn't be enough if we were.
* rpc: Add listen address to incoming connections in `getpeerinfo`Wladimir J. van der Laan2017-06-051-5/+27
| | | | | | | | | | | This adds the listening address on which incoming connections were received to the CNode and CNodeStats structures. The address is reported in `getpeerinfo`. This can be useful for distinguishing connections received on different listening ports (e.g. when using a different listening port for Tor hidden service connections) or different networks.
* Merge #10441: net: only enforce expected services for half of outgoing ↵Wladimir J. van der Laan2017-06-011-1/+20
|\ | | | | | | | | | | | | | | connections b6fbfc2 net: only enforce the services required to connect (Cory Fields) Tree-SHA512: 88943bff63213a734f3c96c45760cadaeb9ba18287c8a20c279851ebaf058a334c969028fb2180f155508e3eea4b838147382e4f2b655e7a9aa098eadc81d53e
| * net: only enforce the services required to connectCory Fields2017-05-281-1/+20
| | | | | | | | | | also once half of all outgoing nodes have our preferred flags, require only minimal flags from the rest.
* | add SeedNodes to CConnman::OptionsMarko Bencun2017-05-301-2/+6
|/ | | | | Start of a series of changes to clean up the instantiation of connman by decoupling the command line arguments.
* Populate services in GetLocalAddressAlex Morcos2017-05-181-1/+1
| | | | | | Previously if we didn't have any local addresses, GetLocalAddress would return 0.0.0.0 and then we'd swap in a peer's notion of our address in AdvertiseLocal, but then nServices would never get set.
* Merge #10061: [net] Added SetSocketNoDelay() utility functionPieter Wuille2017-05-171-6/+1
|\ | | | | | | | | | | ad415bc [net] Added SetSocketNoDelay() utility function (Thomas Snider) Tree-SHA512: c19e3c9910b3fc2ef86f2434f3e91d343e9cd9e2116153941de9789e2a6fc0389bffe762d21b55cda4a4b1de993afee0564c6946e65d05cef9e866b58896f9af
| * [net] Added SetSocketNoDelay() utility functionThomas Snider2017-04-051-6/+1
| |
* | Merge #9494: Introduce an ArgsManager class encapsulating cs_args, mapArgs ↵Wladimir J. van der Laan2017-05-151-5/+5
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and mapMultiArgs 78da882 Util: Small improvements in gArgs usage (Jorge Timón) 5292245 Util: Put mapMultiArgs inside ArgsManager (Jorge Timón) b3cbd55 scripted-diff: Util: Encapsulate mapMultiArgs behind gArgs (Jorge Timón) f2957ce Util: Create ArgsManager class... (Jorge Timón) Tree-SHA512: 7d58250da440ad0f41745f46ab6021d6ecbb292035cab3d86fb08ce6bd822df604ac31b3ded6fd6914f7cfd12ba531cbc06a76eb500f629627f47ae6ac8350a7
| * | scripted-diff: Util: Encapsulate mapMultiArgs behind gArgsJorge Timón2017-05-091-5/+5
| | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i 's/mapMultiArgs.count(/gArgs.IsArgSet(/g' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ; sed -i 's/mapMultiArgs.at("/gArgs.GetArgs("/g' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ; -END VERIFY SCRIPT-
* | | Merge #10189: devtools/net: add a verifier for scriptable changes. Use it to ↵Wladimir J. van der Laan2017-05-071-7/+7
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | make CNode::id private. 0f3471f net: make CNode's id private (Cory Fields) 9ff0a51 scripted-diff: net: Use accessor rather than node's id directly (Cory Fields) e50c33e devtools: add script to verify scriptable changes (Cory Fields) Tree-SHA512: a0ff50f4e1d38a2b63109b4996546c91b3e02e00d92c0bf04f48792948f78b1f6d9227a15d25c823fd4723a0277fc6a32c2c1287c7abbb7e50fd82ffb0f8d994
| * | net: make CNode's id privateCory Fields2017-05-041-1/+1
| | |
| * | scripted-diff: net: Use accessor rather than node's id directlyCory Fields2017-05-041-6/+6
| | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i "s/\(node\|to\|from\)->id/\1->GetId()/" src/net.cpp src/net_processing.cpp -END VERIFY SCRIPT-
* | | Merge #10234: [net] listbanned RPC and QT should show correct banned subnetsWladimir J. van der Laan2017-05-021-3/+5
|\ \ \ | |/ / |/| | | | | | | | | | | | | | d6732d8 [tests] update disconnect_ban.py test case to work with listbanned (John Newbery) 77c54b2 [net] listbanned RPC and QT should show correct banned subnets (John Newbery) Tree-SHA512: edd0e43377d456260d2697213c2829f8483630f3a668b6707d52605faefa610d951d10e6f22a95eff483cbd14faa8ac9b69fa7d3c0b5735c5f3df23fd71282e0
| * | [net] listbanned RPC and QT should show correct banned subnetsJohn Newbery2017-04-281-3/+5
| | |
* | | Merge #9930: Trivial: Correct indentation and bracingWladimir J. van der Laan2017-04-261-51/+47
|\ \ \ | |/ / |/| | | | | | | | | | | 31a14d4 Correct indentation and remove unnecessary braces (Matthias Grundmann) Tree-SHA512: c0e827ec4474133c7674254dfd13f59608820cd639debc7759bddae71d73451645fcfe14384f343d08f74d69ac3922bafc12a514f3b790ae2bf9271aa67d5f36
| * | Correct indentation and remove unnecessary bracesMatthias Grundmann2017-04-021-51/+47
| | |
* | | Check interruptNet during dnsseed lookupsMatt Corallo2017-04-141-0/+6
|/ /
* / Change LogAcceptCategory to use uint32_t rather than sets of strings.Gregory Maxwell2017-04-011-23/+23
|/ | | | | | | | | | | | | | | | | This changes the logging categories to boolean flags instead of strings. This simplifies the acceptance testing by avoiding accessing a scoped static thread local pointer to a thread local set of strings. It eliminates the only use of boost::thread_specific_ptr outside of lockorder debugging. This change allows log entries to be directed to multiple categories and makes it easy to change the logging flags at runtime (e.g. via an RPC, though that isn't done by this commit.) It also eliminates the fDebug global. Configuration of unknown logging categories now produces a warning.
* Merge #9987: Remove unused codeWladimir J. van der Laan2017-03-181-5/+0
|\ | | | | | | | | | | 8dc957a Remove unused code (practicalswift) Tree-SHA512: c7bb286e3b92e42fec8aa1ac2491fd38be36602efca16b4bdc4e9d5ada75c11d99e7713092ec13794abd69d5ef2c732b86209a6d01710e5ebf6fc51b8a65c92a
| * Remove unused codepracticalswift2017-03-171-5/+0
| |
* | Merge #9921: build: Probe MSG_DONTWAIT in the same way as MSG_NOSIGNALWladimir J. van der Laan2017-03-161-1/+6
|\ \ | |/ |/| | | | | | | | | | | a4d1c9f compat: use `unsigned int` instead of `u_int` (Wladimir J. van der Laan) 25da1ee build: cleanup: define MSG_DONTWAIT/MSG_NO_SIGNAL locally (Wladimir J. van der Laan) c459d50 build: Probe MSG_DONTWAIT in the same way as MSG_NOSIGNAL (Wladimir J. van der Laan) Tree-SHA512: 60d79d69439bb181465e4244aa5ddc28bbd84f69c0ca0c753956b3798c9022394e29d791bc085fe7ffb1268c64c789a57e24797daad63525bb776088188ff9ae
| * build: cleanup: define MSG_DONTWAIT/MSG_NO_SIGNAL locallyWladimir J. van der Laan2017-03-051-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | Define MSG_DONTWAIT and MSG_NO_SIGNAL in the implementation files that use them (`net.cpp` and `netbase.cpp`), instead of compat.h which is included all over the place. This avoids putting them in the global namespace, as defining them as 0 is a hack that works for our specific usage, but it is not a general solution. Also makes sure they are defined only once so the `!defined(MSG_x)` guard can go.
* | Add missing braces in semaphore posts in netMatt Corallo2017-03-081-4/+8
| |
* | Fix shutdown hang with >= 8 -addnodes setMatt Corallo2017-03-081-4/+4
| | | | | | | | | | | | | | We previously would block waiting for a CSemaphoreGrant in ThreadOpenAddedConnections, when we did not need to. This would block as the posts in CConnman shutdown were both to the wrong semaphore and in the wrong location.
* | CScheduler boost->std::function, use millisecs for times, not secsMatt Corallo2017-03-061-1/+1
|/
* Trivial: Debug log ambiguity fix for peer addrskeystrike2017-02-281-2/+3
| | | | This line can be misinterpreted as loading wallet addresses which is confusing, especially when the wallet is disabled.
* Merge #9715: Disconnect peers which we do not receive VERACKs from within 60 secWladimir J. van der Laan2017-02-141-0/+5
|\ | | | | | | | | | | | | 66f861a Add a test for P2P inactivity timeouts (Matt Corallo) b436f92 qa: Expose on-connection to mininode listeners (Matt Corallo) 8aaba7a qa: mininode learns when a socket connects, not its first action (Matt Corallo) 2cbd119 Disconnect peers which we do not receive VERACKs from within 60 sec (Matt Corallo)
| * Disconnect peers which we do not receive VERACKs from within 60 secMatt Corallo2017-02-071-0/+5
| |
* | Move CNode::addrLocal access behind locked accessorsMatt Corallo2017-02-101-4/+20
| |
* | Move CNode::addrName accesses behind locked accessorsMatt Corallo2017-02-101-8/+22
| |
* | Move [clean|str]SubVer writes/copyStats into a lockMatt Corallo2017-02-101-1/+4
| |
* | Access fRelayTxes with cs_filter lock in copyStatsMatt Corallo2017-02-101-1/+4
| |
* | Avoid copying CNodeStats to make helgrind OK with buggy std::stringMatt Corallo2017-02-101-3/+2
| |
* | Make nTimeConnected const in CNodeMatt Corallo2017-02-101-1/+1
| |
* | net: fix a few races. Credit @TheBlueMattCory Fields2017-02-101-5/+11
| | | | | | | | | | | | | | | | | | | | | | These are (afaik) all long-standing races or concurrent accesses. Going forward, we can clean these up so that they're not all individual atomic accesses. - Reintroduce cs_vRecv to guard receive-specific vars - Lock vRecv/vSend for CNodeStats - Make some vars atomic. - Only set the connection time in CNode's constructor so that it doesn't change
* | Merge #9698: net: fix socket close raceWladimir J. van der Laan2017-02-101-26/+48
|\ \ | | | | | | | | | | | | 9a0b784 net: add a lock around hSocket (Cory Fields) 45e2e08 net: rearrange so that socket accesses can be grouped together (Cory Fields)
| * | net: add a lock around hSocketCory Fields2017-02-061-15/+28
| | |
| * | net: rearrange so that socket accesses can be grouped togetherCory Fields2017-02-061-14/+23
| |/
* | Merge #9674: Always enforce strict lock ordering (try or not)Wladimir J. van der Laan2017-02-081-10/+8
|\ \ | |/ |/| | | | | | | | | 618ee92 Further-enforce lockordering by enforcing directly after TRY_LOCKs (Matt Corallo) 2a962d4 Fixup style a bit by moving { to the same line as if statements (Matt Corallo) 8465631 Always enforce lock strict lock ordering (try or not) (Matt Corallo) fd13eca Lock cs_vSend and cs_inventory in a consistent order even in TRY (Matt Corallo)
| * Fixup style a bit by moving { to the same line as if statementsMatt Corallo2017-02-041-6/+3
| |
| * Lock cs_vSend and cs_inventory in a consistent order even in TRYMatt Corallo2017-02-021-5/+6
| |
* | Merge #9659: Net: Turn some methods and params/variables constWladimir J. van der Laan2017-02-061-3/+3
|\ \ | | | | | | | | | | | | | | | 0729102 Net: pass interruptMsgProc as const where possible (Jorge Timón) fc7f2ff Net: Make CNetMsgMaker more const (Jorge Timón) d45955f Net: CConnman: Make some methods const (Jorge Timón)
| * | Net: CConnman: Make some methods constJorge Timón2017-01-311-3/+3
| |/
* | Merge #9671: Fix super-unlikely race introduced in 236618061a445d2cb11e72Wladimir J. van der Laan2017-02-041-1/+1
|\ \ | | | | | | | | | 885cfdd Fix super-unlikely race introduced in 236618061a445d2cb11e72 (Matt Corallo)
| * | Fix super-unlikely race introduced in 236618061a445d2cb11e72Matt Corallo2017-02-021-1/+1
| |/ | | | | | | | | | | | | | | | | Once the CNode has been added to vNodes, it is possible that it is disconnected+deleted in the socket handler thread. However, after that we now call InitializeNode, which accesses the pnode. helgrind managed to tickle this case (somehow), but I suspect it requires in immensely braindead scheduler.
* | net: log an error rather than asserting if send version is misusedCory Fields2017-02-021-0/+27
| | | | | | | | | | Also cleaned up the comments and moved from the header to the .cpp so that logging headers aren't needed from net.h
* | net: don't run callbacks on nodes that haven't completed the version handshakeCory Fields2017-02-021-1/+6
|/ | | | | | | | | Since ForEach* are can be used to send messages to all nodes, the caller may end up sending a message before the version handshake is complete. To limit this, filter out these nodes. While we're at it, may as well filter out disconnected nodes as well. Delete unused methods rather than updating them.
* Merge #9626: Clean up a few CConnman cs_vNodes/CNode thingsWladimir J. van der Laan2017-01-301-42/+14
|\ | | | | | | | | | | 2366180 Do not add to vNodes until fOneShot/fFeeler/fAddNode have been set (Matt Corallo) 3c37dc4 Ensure cs_vNodes is held when using the return value from FindNode (Matt Corallo) 5be0190 Delete some unused (and broken) functions in CConnman (Matt Corallo)