Commit Graph

45 Commits

Author SHA1 Message Date
Justin Ramos fd95f8f519
allowing for max outbound connection configuration
Signed-off-by: Justin Ramos <justin.ramos@gmail.com>
2017-02-21 16:28:54 -06:00
Peter Šurda d8ae44f9ee
Obsolete imports, missing exception type 2017-02-09 21:04:07 +01:00
Peter Šurda c778b81427
knownNodes refactoring and shutdown fixes
- saveKnownNodes replaced the repeated pickle.dump
- with knownNodesLock instead of acquire/release
- outgoingSynSender had an unnecessary loop during shutdown causing
  excessive CPU usage / GUI freezing
2017-02-09 11:53:33 +01:00
Peter Šurda 59f3a2fbe7
Reduce cyclic dependencies
- rearranged code to reduce cyclic dependencies
- doCleanShutdown is separated in shutdown.py
- shared queues are separated in queues.py
- some default values were moved to defaults.py
- knownnodes partially moved to knownnodes.py
2017-02-08 13:41:56 +01:00
Peter Šurda ba130e03e5
Network subsystem freezing fixes
- queues were too short
- some error handling was missing
- remove nonblocking repeats in receive data thread
- singleCleaner shouldn't wait unnecessarily
2017-02-02 15:52:32 +01:00
Peter Šurda 9ed59dd825
Shutdown procedure cleanup 2017-01-16 23:38:18 +01:00
Peter Šurda 6d2a75bfc9
Transfer speed improvements
- send buffer to send multiple commands in one TCP packet
- recv/send operation size now based on bandwith limit
- send queue limited to 100 entries
- buffer getdata commands to fill send queue, instead of waiting for the
  data packet to arrive first (i.e. allow getdata to work asynchronously)
2017-01-15 15:08:03 +01:00
Peter Šurda ad75552b5c
Move shutdown from shared.py to state.py 2017-01-14 23:20:15 +01:00
Peter Šurda ff8deebf60
Keep track of network protocol status 2017-01-12 19:18:56 +01:00
Peter Šurda bd520a340f
Trustedpeer fix and more refactoring
- fixed trustedPeer (thanks to anonymous bug reporter)
- moved trustedPeer and Peer into state.py
2017-01-12 06:58:35 +01:00
Peter Šurda ac348e4e6b
Fixes and refactoring
- fixes errors introduced in the earlier refactoring
- more variables moved to state.py
- path finding functions moved to paths.py
- remembers IPv6 network unreachable (in the future can be used to skip
  IPv6 for a while)
2017-01-11 17:00:00 +01:00
Peter Šurda 8bcfe80ad0
Refactoring of config parser and shared.py
- got rid of shared config parser and made it into a singleton
- refactored safeConfigGetBoolean as a method of the config singleton
- refactored safeConfigGet as a method of the config singleton
- moved softwareVersion from shared.py into version.py
- moved some global variables from shared.py into state.py
- moved some protocol-specific functions from shared.py into protocol.py
2017-01-11 14:27:19 +01:00
Peter Šurda b9748c55aa
Don't connect to self fix
- the hidden service don't connect to yourself fix was broken, this
  fixes the fix
2016-11-14 20:20:41 +01:00
Peter Šurda 756f85c9f0
Don't connect to yourself when hidden service 2016-11-08 08:49:43 +01:00
Peter Šurda 4436c5f3d1
More proxy fixes
- proxy connection should be able to handle IPv6 correctly
- UI status bar notification typo fix
2016-10-20 02:49:07 +02:00
Peter Šurda ab79ee2a04
Proxy error handling
- UI will now display notifications in the status bar if the connection
  to the proxy itself is broken. This should give better feedback to
  people who are unfamiliar with tor and misconfigured it
- The proxy error handling in the background was slightly improved as
  well
2016-10-20 01:49:40 +02:00
Peter Šurda 4117195b61
Don't freeze when out of known nodes
- bitmessage could end up having no known nodes and then it would
  freeze. Now it shouldn't freeze, however it can still end up without
  known nodes until a restart in some cases (e.g. when suspending the
  computer for more then 3 days while BM is running)
2016-08-14 15:03:18 +02:00
Peter Šurda efa12c3ac6
Do not connect on shutdown
- in some cases, such as when using trustedpeer, outgoingSynSender
  threads would wake up and try to connect. This fixes it.
2016-06-18 20:35:16 +02:00
Peter Šurda fbed1eff31
Socks error handling
- Socks errors are now handled in a smoother manner
2016-06-10 12:43:37 +02:00
Peter Šurda 1a40c29d22
Add Tor hidden service support
- PyBitmessage can now run as a hidden service on Tor
- three new variables in keys.dat: onionhostname, onionport, onionbindip
- you need to manually add a hidden service to tor
2016-06-07 21:59:48 +02:00
Peter Šurda 33991f4598
Implement node priority
- prioritise connecting to nodes that were online more recently
- hidden service nodes have a higher priority if using tor
2016-06-07 12:23:47 +02:00
mailchuck 9edde110a2 Translation update
Some function calls were not being identified as text that should be
translated.
2016-05-02 15:00:26 +02:00
Peter Šurda 143abe3c34 Preliminary Tor hidden service support 2016-05-02 15:00:24 +02:00
Peter Šurda 4c2ce7208c Sleep on invalid getdata
- postpone initial sleep until the first getdata is received
- also sleep when received a getdata request for an object that hasn't
been advertised to the other node yet
2016-05-02 15:00:24 +02:00
mailchuck 47f1c0c267 Thread names for IPv6
Thread names for IPv6 contained ":". This caused problems in log
parsers.
2016-05-02 15:00:23 +02:00
mailchuck 0c19e0c2e4 Failure to connect shouln't be an error
It resulted in too many errors in the logs
2016-05-02 15:00:21 +02:00
mailchuck ff358b1a1f Typo 2016-05-02 15:00:21 +02:00
mailchuck ec68146135 Suppress error on releasing unlocked lock 2016-05-02 15:00:21 +02:00
mailchuck b00c4f24ec Threads close better
- UPnP and outgoingSynSender threads close slightly better.
- extPort initialisation was missing
2016-05-02 15:00:21 +02:00
mailchuck 231219a193 Improved logging
Fixes #118

- changed almost all "print" into logger
- threads have nicer names
- logger can have configuration in "logger.dat" in the same directory as
"keys.dat", and the logger will pick the one named "default" to replace
the "console" and "file" that are in PyBitmessage otherwise

Example file for logging to syslog:

[loggers]
keys = root,syslog

[logger_root]
level=NOTSET
handlers=syslog

[logger_syslog]
level=DEBUG
handlers=syslog
qualname=default

[handlers]
keys = syslog

[handler_syslog]
class = handlers.SysLogHandler
formatter = syslog
level = DEBUG
args=(('localhost', handlers.SYSLOG_UDP_PORT),
handlers.SysLogHandler.LOG_LOCAL7)

[formatters]
keys = syslog

[formatter_syslog]
format=%(asctime)s %(threadName)s %(filename)s@%(lineno)d %(message)s
datefmt=%b %d %H:%M:%S
2016-05-02 15:00:21 +02:00
Jonathan Warren 0865e863ec Added ability to limit network transfer rate 2014-09-10 16:47:51 -04:00
Jonathan Warren 38d7db24ad Merge pull request #639 from bpeel/wip/trusted-peer
Add a 'trustedpeer' option to keys.dat
2014-04-30 17:42:28 -04:00
Jonathan Warren 114ba4e23a slightly modify IPv6 modifications so that IPv4-only hosts properly handle v6 IPs 2014-04-27 18:05:43 -04:00
Neil Roberts 7da6ea958f Add support for IPv6
It will now listen on an IPv6 socket if possible or fall back to IPv4
if that doesn't work. It will no longer filter out all IPv6 addresses
and instead it will only filter out those that point to the local
network.

It looks like the DNS bootstrapping should just automatically work
because getaddrinfo already returns IPv6 addresses from the AAAA
record.

In order to convert from the ASCII representation of IPv6 addresses
and back we need inet_ntop and inet_pton. Python 2 doesn't currently
provide these for Windows so instead this patch provides a hot patch
to the socket module which wraps WSAStringToAddress and
WSAAddressToString using ctypes.
2014-03-12 01:48:48 +00:00
Neil Roberts 03263156de Add a 'trustedpeer' option to keys.dat
If this option is specified in keys.dat then Bitmessage will connect
to the host specified there instead of connecting to the hosts in the
list of known nodes. It will also stop listening for incoming
connections and the timing attack mitigation will be disabled.

The expected use case is for example where a user is running a daemon
on a dedicated machine in their local network and they occasionally
want to check for messages using a second instance of the client on
their laptop. In that case it would be much faster to catch up with
the messages by directly downloading from the dedicated machine over
the LAN. There is no need to connect to multiple peers or to do the
timing attack mitigation because the daemon is trusted.

The host is specified as hostname:port. Eg, ‘192.168.1.8:8444’.
2014-02-06 13:16:07 +00:00
Jonathan Warren 61389b64aa fix #590 2013-12-29 22:36:23 -05:00
Jonathan Warren 0d5f2680d4 various modifications to previous commit regarding ability to select language 2013-08-27 22:29:39 -04:00
Jonathan Warren 5c3bc63a1f Only allow 1 connection per IP 2013-08-01 12:16:31 -04:00
nobody d606bb1333 Fix: Distinguish peers by both IP address and port.
Until now many parts of the code assumed that IP addresses are
unique for peers. However, more than one Bitmessage instance might
be running with a given IP address due to multi-user systems or
firewalls.
2013-07-30 22:23:18 +02:00
Jonathan Warren 350e8d66c7 Prompt user to connect at first startup 2013-07-24 11:46:28 -04:00
Jonathan Warren d036ca18ed Completed chan integration in the GUI 2013-07-22 01:10:22 -04:00
Linker Lin 4a84a30fc6 replace acquire lock by 'with' statement 2013-06-30 01:29:35 +08:00
Jonathan Warren c857f73d0b Continued moving code into individual modules 2013-06-24 15:51:01 -04:00
Jordan Hall 2eb6558cf1 Added a number of missing imports fixing several issues (thank you PyDev) 2013-06-23 20:52:39 +01:00
Jordan Hall fe8998ca3a Seperating out all peer networking classes and merging with upstream 2013-06-22 00:49:50 +01:00