Commit Graph

171 Commits

Author SHA1 Message Date
tomFlowee c083a56916 Add guards for ssl functionlity of network manager
When Boost is too old, avoid compiling the SLL features into the network
manager.
2025-02-11 20:16:32 +01:00
tomFlowee 25c0ad9650 Redo the callback handling in the proxy
This makes the unit test work, specifically it ensures the callbacks are
done in the strand.
2025-02-11 19:23:14 +01: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 bb7275466b Stop using deprecated asio io_service
This ports the io-service to the source compatible io-context
class, with the most work going to the WorkerThreads which owns
that one.
2025-02-08 19:05:26 +01:00
tomFlowee da4321e6a6 Minor language update 2024-10-20 12:18:21 +02:00
tomFlowee be89f191e9 Add todo 2024-09-16 23:18:47 +02:00
tomFlowee e5986f6199 remove unused include 2024-09-10 19:14:01 +02:00
tomFlowee 9bb8311a5f Minor clarifications.
Rename variable to talk about message instead of package (which probably
was meant to be packet anyway).
Make log message of exception we caught a little more useful.
2024-09-10 19:06:07 +02:00
tomFlowee b060064d45 Cleanups 2024-08-21 19:45:32 +02:00
tomFlowee 3a25af6f0e Complete the new SSL connections in networkmanager
This completes the API and makes the unit test pass.
2024-08-21 17:58:45 +02:00
tomFlowee 7fcecedd76 Make handshake of ssl connection work. 2024-08-21 16:55:01 +02:00
tomFlowee 69b3d78e19 Making the ssl unit test work. 2024-08-20 22:46:48 +02:00
tomFlowee af5a76f9aa Add server functionality to ssl connections. 2024-08-13 22:56:24 +02:00
tomFlowee 87d771ba8f Merge branch 'master' into sslNetworkManager 2024-08-13 22:55:47 +02:00
tomFlowee 2879587a64 OnDisconnected now shows it is disconnected
The onDisconnected callback is moved to later in the process after the
internal state has been updated so calling 'isConnected()' is what you'd
expect.
2024-08-11 20:32:32 +02:00
tomFlowee 69e275ae4c Add connection-id in debug output
In the networkmanager it may get confusing to see lines without knowing
which connection actually created it. So we add the connection id.
2024-08-11 20:32:32 +02:00
tomFlowee 8c31f8d004 Revert "Make simpler"
This reverts commit e28b5e1823.

The port number is again passed through the dns lookup, which is
weird as fuck but needed to get the actual resulting iterator still
have the port numebr we wanted to connect to.
2024-08-11 19:37:21 +02:00
tomFlowee b84a934977 comments 2024-08-11 18:49:35 +02:00
tomFlowee 93c413a004 Make simple (plain) stuff work again. 2024-08-11 18:49:35 +02:00
tomFlowee f0d426dc90 make compile 2024-08-11 18:49:35 +02:00
tomFlowee d2ce7e61d2 Refactor socket to live in a wrapping class. 2024-08-11 18:49:35 +02:00
tomFlowee 712dcdb3a6 Start to implement the ssl server. 2024-08-11 18:49:35 +02:00
tomFlowee b4e90cf945 Add ssl lib to networkmanager 2024-08-11 18:49:35 +02:00
tomFlowee 210fef16cc Start making space for an ssl backend. 2024-08-11 18:49:35 +02:00
tomFlowee e28b5e1823 Make simpler 2024-05-01 21:54:22 +02:00
tomFlowee ee354b62d1 Avoid repeating myself. 2024-02-12 21:29:33 +01:00
tomFlowee eace700859 Add EndPoint::isOutgoing() -> bool & isIncomimg() 2024-01-24 21:06:25 +01:00
tomFlowee 4fe9d69e7b Use more specific define-guards 2024-01-24 21:03:58 +01:00
tomFlowee ef95af0177 Define the lifetime better.
A connection that is 'shutdown' now ensures one more time we'll call
onDisconnected() (is it was..) allowing the application level logic to
get notified and avoid memory leaks.
2024-01-24 21:03:58 +01:00
tomFlowee 40e5eaa78d Add EndPoint::toString() 2024-01-21 23:16:56 +01:00
tomFlowee ccd53255f8 Avoid doing unneeded work.
When the user-layer triggers a re-connect instead of waiting for the
layer to re-connect then we should avoid doing work twice.
This also avoids a reconnect in some cases.
2024-01-08 16:57:50 +01:00
tomFlowee 64bfb76e06 Linter found issues, we fix 2024-01-08 14:01:21 +01:00
tomFlowee bc47a700a4 Refactor; wrap BufferPool in shared_ptr
As we moved most of the creation of a BufferPool to be via the
Streaming::pool() method, which uses a thread-local, it makes sense
to start cleaning up the design and make it more modern C++.
The above mentioned method would return a reference and you'd see
loads of places use `auto &pool =` which is less than ideal.

As the number of places where we actually instantiate a BufferPool
goes down, the usage of some sort of smart pointer makes more sense.

This now makes all APIs use BufferPool be wrapped in a shared_ptr.
2023-12-21 15:23:23 +01:00
tomFlowee 220965ceae Add operator== to EndPoint 2023-08-13 13:59:24 +02:00
tomFlowee f1f148496f Add API docs. 2023-08-02 11:54:05 +02:00
tomFlowee 9f16d67460 Make API more robust
this avoids the endPoint() method sometimes throwing an exception from
std::map::at confusing the caller.
2023-07-20 20:59:26 +02:00
tomFlowee 9685d484cc Init member var 2023-07-17 21:01:59 +02:00
tomFlowee c8fe78f28e whitespace cleanup 2023-07-15 22:01:30 +02:00
tomFlowee 166f646cc3 Fixes in API / docs 2023-07-15 20:01:26 +02:00
tomFlowee 6951a9f13a Add missing reserve() call 2023-01-31 20:29:51 +01:00
tomFlowee a711c38a77 Don't connect when the reconnect is underway
Avoid massive connect storm.
Using the network manager based logger we got into a fun situation where
logging to a remote host caused us to connect and fail, which caused us
to log this failed which made us try to connect and .. etc.
2022-12-20 15:32:58 +01:00
tomFlowee 7163605b00 Make sure login messages are sent first
When the client sent a message in the onConnected callback, it managed
to get in front of the login message. This fixes that.
2022-12-03 23:30:01 +01:00
tomFlowee bfda224542 Use static_cast instead. 2022-11-08 12:23:00 +01:00
tomFlowee f4ed75f316 Avoid auto-cast, clang didn't like it.
This avoids the code behaving differently under clang.
2022-11-04 11:49:43 +01:00
tomFlowee 126de2a231 Add new NetworkConnection::setLoginMessageCreator() 2022-11-03 23:40:31 +01:00
tomFlowee 6f4ef3bbdb Detect when outgoing connection died
The server always sends pongs in response to our pings, but we assumed
that the underlying OS would close a connection when the other side
isn't replying (ACKs).

Now we take this responsibility in the code and when no pongs are
registered we also close and re-establish the connection.

This additionally shortens the ping time to 30 seconds and the timeout
to 90 seconds.
2022-04-20 11:41:15 +02:00
tomFlowee df002c4973 Count the 'endofheader' byte too.
A header is actually never empty, but lets not make that assumption in
code.
2022-04-20 11:37:33 +02:00
tomFlowee 9a332d9b7b Fix endless loop bug 2022-03-23 22:48:44 +01:00
tomFlowee c7a3478be2 Fix constructor from sometimes throwing 2022-01-26 15:27:30 +01:00
tomFlowee 1d25e45a1c Reconcile more places to use pools API
This removes 2 more custom solutions to converge on one
  Streaming::pool()
namespaced method.
2022-01-25 23:20:12 +01:00