Commit Graph

32 Commits (171bc83ec0bde275602d6545255d83400a36093d)

Author SHA1 Message Date
Peter Šurda 59e1739136
Revert duplicate IP treatment for bootstrap
- bootstrap provider mode shouldn't accept multiple connections from a
  single IP after all, it creates problems
7 years ago
Peter Šurda 339e375958
Bootstrap provider mode and minor knownNodes changes
- if knownNodes grows to 20000, instead of ignoring new nodes, forget
  the 1000 oldest ones
- drop connection after sendaddr if too many connections, even if it's
  an outbound one
- if maximum total connections are lower than maximum outbound
  connections, active bootstrap provider mode
- in this mode, check all addresses received before announcing them
- so basically it only annouces those addresses it successfully
  connected to
7 years ago
Peter Šurda 7ebe837eb0
Make some network parameters configurable
- maxtotalconnections = maximum number of total full connections
  (incoming + outgoing) the node will allow. Default 200 as it was.
- maxbootstrapconnections = number of additional (to total) connection
  that will act in bootstrap mode, closing after sending the list of
  addresses. Default 20 as it was.
- maxaddrperstreamsend = initial address list maximum size, per
  participating stream. Default 500. Child streams get half. The
  response is chunked into pieces of max. 1000 addresses as that's the
  protocol limit.
7 years ago
Peter Šurda 0fa0599cd4
IPv4 listen socket fix
- on OpenBSD, you can't have a socket that supports both IPv4 and IPv6.
  This allows handling for this error, and then it will try IPv4 only,
  just like for other similar errors.
7 years ago
Peter Šurda 191650f5a4
- previous commit contained typos
7 years ago
Peter Šurda b1b0c46555
Improve exception handling
- there were reports of errors in FreeBSD (I could only reproduce some)
  and Gentoo without IPv4 support (I don't have a VM for testing ready)
- adds an exception handler for double task_done in case sender thread
  has to close prematurely (I saw this triggered on FreeBSD 11)
- listening socket opening error handler was broken (triggered if you
  can't open a socket with both IPv4 and IPv6 support)
- error handler for socket.accept. Reported on FreeBSD 10.3
- fixes #854
7 years ago
Peter Šurda 6062277d60
Rename to
- it was causing problems with py2app because the source of python's own
  CongigParser is also
7 years ago
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
7 years ago
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)
7 years ago
Peter Šurda ad75552b5c
Move shutdown from to 7 years ago
Peter Šurda bd520a340f
Trustedpeer fix and more refactoring
- fixed trustedPeer (thanks to anonymous bug reporter)
- moved trustedPeer and Peer into
7 years ago
Peter Šurda 8bcfe80ad0
Refactoring of config parser and
- 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 into
- moved some global variables from into
- moved some protocol-specific functions from into
7 years ago
Peter Šurda 0dd54e606d
Multiple connections on hidden service fix
- there was a bug which prevented multiple parallel connections on
  hidden service
8 years ago
Peter Šurda f242d409fd
Tor hidden service fixes
- will send the correct combination of hostname and port
- if proxyhostname is a hostname and an IP address, it will now allow
  multiple parallel connections for hidden service
8 years ago
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
8 years ago
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
8 years ago
mailchuck d69c2e097f Cleaner shutdown
Addresses Bitmessage#549
8 years ago
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:

keys = root,syslog



keys = syslog

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

keys = syslog

format=%(asctime)s %(threadName)s %(filename)s@%(lineno)d %(message)s
datefmt=%b %d %H:%M:%S
8 years ago
Jonathan Warren c306062282 Bitmessage Protocol Version Three 9 years ago
Jonathan Warren 38d7db24ad Merge pull request #639 from bpeel/wip/trusted-peer
Add a 'trustedpeer' option to keys.dat
10 years ago
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

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

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.
10 years ago
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, ‘’.
10 years ago
Jonathan Warren 61389b64aa fix #590 10 years ago
Jonathan Warren c27494ace9 Further work to implement the Connect dialog on startup 11 years ago
Jonathan Warren 350e8d66c7 Prompt user to connect at first startup 11 years ago
David Nichols 27c0ac436c Updating code comments to reflect changes in listening for connections when using SOCKS. 11 years ago
David Nichols 97f0c56aa8 Adding configuration option to listen for connections when operating with a SOCKS proxy. 11 years ago
Linker Lin 4a84a30fc6 replace acquire lock by 'with' statement 11 years ago
Jonathan Warren c857f73d0b Continued moving code into individual modules 11 years ago
Jordan Hall fe8998ca3a Seperating out all peer networking classes and merging with upstream 11 years ago
Jordan Hall 27a8662f22 Seperating class_singleListener, class_receiveDataThread, class_sendDataThread 11 years ago
Jordan Hall ebc62b9edc Moving certain classes outside of 11 years ago