23 Commits

Author SHA1 Message Date
tomFlowee 51c24cefaf Remove unused include 2025-06-21 17:40:33 +02:00
tomFlowee 5cae07500c Port away from deprecated ASIO methods
This makes thehub compile with BOOST_ASIO_NO_DEPRECATED defined.
2025-02-11 16:46:21 +01:00
tomFlowee 7fcecedd76 Make handshake of ssl connection work. 2024-08-21 16:55:01 +02:00
tomFlowee 126de2a231 Add new NetworkConnection::setLoginMessageCreator() 2022-11-03 23:40:31 +01:00
tomFlowee c7a3478be2 Fix constructor from sometimes throwing 2022-01-26 15:27:30 +01:00
tomFlowee 56f083e3b6 Ensure sane queue size
This is based on the fact that a ringbuffer is not very happy if its only
got one element.
2021-08-05 22:02:45 +02:00
tomFlowee e6b02da76b Add secure way to do login on incoming connections.
This adds a baseclass for clients to inherit to make it even easier to
do login. Check ConnectionAuthorizer
2021-06-27 12:37:46 +02:00
TomZ 046c956230 Avoid sideeffects after a move. 2021-02-22 15:52:34 +01:00
TomZ 713697525a A network buffer maximum size of 6MB sounds fine for a server.
This is for the connection to the hub/indexer, so not for the incoming
clients.
Increasing the size allows much larger traffic without delay.
2020-09-02 13:47:32 +02:00
TomZ 00453d52c4 NWM: Reuse connection objects
Avoid deleting and creating connections, which is really a rather rare
event anyway, and simply remember the connection object and reuse it
when a new one is requested.
2020-05-10 16:01:08 +02:00
TomZ d49b1ae5e2 Make NetworkManager connections leaner
The NetworkManager usage was mostly for low connection counts and this
made defaults selection easy.
With more usages it is important to allow the NWM-connection to be more
configurable about memory usage and leaner in general.

This changes the headers-buffers (used to create envelopes) to not be per
connection anymore but per thread using the tread_local keyword.

This changes the ring-buffers to become configurable using
NetworkConnections::setMessageQueueSizes().

Also removing some include statements where they were not really needed
in the P2PNet lib.
2020-05-09 20:23:05 +02:00
TomZ 5bb095f8a2 Minor fixes in usage of shared pointers. 2020-05-07 18:26:41 +02:00
TomZ fb6f91bf79 Simplify p2pnet ownership
Make the Peer object be owned by a shared pointer.
2020-05-05 22:53:25 +02:00
TomZ 3f16f6224a Fix the threading model in the P2PNet
This allows deletion of peers also from other threads than their own
assigned ones.
2020-05-03 21:02:45 +02:00
TomZ 436535647f Add several new features to networkmanager
Allow user to shutdown a connection, making it instantly invalid.
Allow user to register a callback for errors.
And fix pinging to be disabled on legacyP2P style connections.
2020-04-01 20:24:04 +02:00
TomZ bf24ed042b Add support for legacy p2p network envelope in networkmanager 2020-03-29 12:55:12 +02:00
TomZ 83d455a5d4 Help devops with more info. 2019-08-29 22:33:57 +02:00
TomZ df7de2ecd2 Clean up the hairy ball of util.cpp
Move some globals and all stuff pulling in crypto to the
server/serverutil.cpp file

Remove dead code.

Move several items that were used in only one place to the respective
files using them.

Move the class WaitUntilFinishedHelper into its own file.

Made sure no header includes utils.h
remove a handfull of files including utils.h for nothing.
2019-08-24 22:25:09 +02:00
TomZ 0c9f415eb8 Several NetworkManager fixes
This adds all the header ints to chunked messages, solving the problem
of losing RequestId on roundtrips if the answer was too big.

Added a unit test for this "new" features.

This makes callbacks all use shared_from_this() in order to avoid
callbacks being done on deleted instances (thanks boost!).

Last, special case when the user doesn't connect but just sends messages
which caused a send of data, only to realize the connection wasn't open,
and then a connect.
This makes sure we immediately start a connect on queue of a message.
2019-06-04 21:40:02 +02:00
TomZ a00938a118 Fix race condition in shutdown of NetworkConnection 2019-06-03 14:37:08 +02:00
TomZ 6cc433c589 Make usage of NetworkConnection::accept() clear
I added some docs to bind() that handlers there should call
accept().
Also made sure that when nobody accepts a connection it actually
gets disconnected instead of just being ignored.
2019-04-10 14:28:33 +02:00
TomZ cec1950650 Make connection wait on destructor
Make sure that a NetworkConnection object (which owns the callbacks)
doesn't return from its destructor until the already scheduled callbacks
in another thread have been completed.

This avoids shutdown scenarios where we execute in a deleted
object.
2019-04-06 11:59:49 +02:00
TomZ 7e737c8ea8 Start library/networkmanger 2018-02-14 13:49:53 +01:00