Commit Graph

146 Commits

Author SHA1 Message Date
Marcel Märtens
0ab7a2543e fix clippy errors 2022-11-28 14:08:11 +01:00
Joshua Yanovski
2c15d0af56 Reduce overhead of messaging systems. 2022-09-14 21:04:53 -07:00
Joshua Yanovski
986d104faa Update Rust toolchain. 2022-09-08 15:43:53 -07:00
tygyh
120ee6b6c0 Fix typos 2022-07-15 18:59:37 +02:00
tygyh
5e5698249b Remove unnecessarily qualified paths 2022-07-15 14:49:46 +02:00
Marcel Märtens
50d85940d8 implement a event channel that posts regular information on events for Participants 2022-07-03 21:21:59 +02:00
Marcel Märtens
c2b043e524 add a comment about QUIC like Isse proposed 2022-07-03 20:51:49 +02:00
Marcel Märtens
b5d0ee22e4 deactivate some features again and only keep the internal code for now to reuse it in automatic reconnect code 2022-06-30 22:14:24 +02:00
Marcel Märtens
f3e4f022cb rather than letting the api/Participant handling the cleanup, we had to move over to the bParticipant::shutdownmanager.
Because the old case didn't account for the Scheduler got dropped but Participant keept around.
Shutdown behavior is quite easy now: bParticipant sends a oneshot, when that hits we stop. also when Participant gets droped we still stop as there woul dbe no sense in continue running the report_mgr ...
2022-06-30 22:14:24 +02:00
Marcel Märtens
5b63035506 Add a new/unstable functionality report_channel.
This will ask the bparticipant for a list of all channels and their respective connection arguments.
With that one could prob reach the remote side.
The data is gathered by scheduler (or channel for the listener code).
It requeres some read logs so we shouldn't abuse that function call.

in bparticipant we have a new manager that also properly shuts down as the Participant holds the sender to the respective receiver.
The sender is always dropped. inside the Mutex via disconnect and outside via Drop (we need 2 Options as otherwise we would create a runtime inside async context implicitly o.O )
(also i didn't liked the alternative by just overwriting the sender with a fake one, i want a propper Option that can be taken)

The code might also come handy in the future when we implement a auto-reconnect feature in the bparticipant.
2022-06-30 22:14:24 +02:00
Marcel Märtens
3da053c8b4 switch from read to read_buf in tcp sink. also always reserve 4 times 1500 as soon as we are under 1500 bytes in order to have less allocations when sending many small msg.
Note: maybe upgrading tokio helps against the connection issues, there is some mio related stuff: https://github.com/tokio-rs/tokio/releases/tag/tokio-1.18.0
Note: quick also still has the old read, but its more complicated, thus i only want to change it if its tested
2022-06-21 21:24:09 +02:00
Marcel Märtens
e194a2e334 export unterlying errors via network crate, to generate more detailed logs 2022-05-23 02:00:56 +02:00
Isse
06f0239130 Avoid clone in Stream::send 2022-05-09 14:48:13 +00:00
Marcel Märtens
97a58f0e14 clean up socket2 networkwork code to do more on the socket2 before convertig it. 2022-02-05 13:08:46 +01:00
Marcel Märtens
dcfde616d0 In case of IPv6 and NON Windows make sure to not listen on dualstack,
for that we need to create a socket2 socket and set_only_v6 to true.
We need to privude set_nonblocking for tokio to work and we need to set reuseaddr for it to work on linux systems
2022-02-05 13:04:16 +01:00
Avi Weinstock
5f8957d8ef Globally allow the clippy lints {new_without_default, many_single_char_names, identity_op, type_complexity, too_many_arguments}. 2022-01-30 20:16:20 +01:00
Jonathan Berglin
596307c9b7 Remove unused clippy suppressions 2021-12-05 17:59:02 +00:00
Marcel Märtens
e29ede7c97 updating dependencies,
cannot update the following dependencies:
 - vek: Sharps SIMD isnt upstream
 - tracing-subscriber: MakeWriter was adjusted and i was to lazy to fiddle with lifetimes,
 - refinery, rustsql: we have a custom refinery version which is incompatible with newer rustsql
 - equi + egui_winit + egui_wgpu_backend: i tried it in this commit but it turned out that they dependo n wgpu which we cant update
 - wgpu: cant update due new version doesnt support DX11

Got quinn updated which now require some dependencies to be explicit.
2021-11-20 20:17:49 +01:00
Marcel Märtens
2a82405df2 update toolchain to nightly-2021-09-24 2021-09-24 23:18:07 +02:00
Marcel Märtens
db8aedd363 fmt after applying clippy fixes after toolchain update 2021-07-12 12:09:27 +02:00
Marcel Märtens
9b3b21f368 fix clippy warnings 2021-07-12 12:09:09 +02:00
Marcel
010f9c250c Merge branch 'aweinstock/nodelay' into 'master'
Enable TCP_NODELAY.

See merge request veloren/veloren!2520
2021-06-27 23:49:01 +00:00
Avi Weinstock
8c5d52b70a Enable TCP_NODELAY. 2021-06-27 17:45:33 -04:00
Marcel Märtens
dd5c9d04b0 fix logging cnt didnt reset 2021-06-27 22:51:23 +02:00
Marcel
f988584337 Merge branch 'revert-c6e200a3' into 'master'
Add a configuration Option to opt-in Quic backend

See merge request veloren/veloren!2318
2021-06-02 14:27:13 +00:00
Imbris
48ebb10d50 Update toolchain 2021-05-31 20:44:57 -04:00
Marcel Märtens
cf3188b412 remove Protocol from Quic, cleanup code, fix some log spam 2021-05-21 10:41:19 +02:00
Joshua Yanovski
e7587c4d9d Added non-admin moderators and timed bans.
The security model has been updated to reflect this change (for example,
moderators cannot revert a ban by an administrator).  Ban history is
also now recorded in the ban file, and much more information about the
ban is stored (whitelists and administrators also have extra
information).

To support the new information without losing important information,
this commit also introduces a new migration path for editable settings
(both from legacy to the new format, and between versions).  Examples
of how to do this correctly, and migrate to new versions of a settings
file, are in the settings/ subdirectory.

As part of this effort, editable settings have been revamped to
guarantee atomic saves (due to the increased amount of information in
each file), some latent bugs in networking were fixed, and server-cli
has been updated to go through StructOpt for both calls through TUI
and argv, greatly simplifying parsing logic.
2021-05-09 21:19:16 -07:00
Marcel Märtens
68d326c817 revert Client drop to be correct again and also stop network properly, reduce timeout to 10s 2021-05-04 22:34:19 +02:00
Marcel Märtens
df7b65289d fix error handling in networking and switch to hashbrown, fixing #1118 2021-05-04 15:29:42 +02:00
Marcel Märtens
653fb065e0 extract protocol specific listen code from scheduler and move it to channel.rs 2021-04-29 17:51:52 +02:00
Marcel Märtens
4afadf57dc move connect code to channel and get rid of unwraps 2021-04-29 15:58:43 +02:00
Marcel Märtens
95b186e29a QuicSink and QuicDrain do work now.
When local SendProtocol is opening a Stream, it will send a empty message to QuicDrain which will then know that its time to open a quic stream.
It will open a QuicStream and send its SID over to remote.
The RecvStream will be send to local QuicSink
RemoteRecv will notice a new BiStream was opened and read its Sid. It will now start listening on it. while remote main will get the information that a stream was opened and will notice the frontend.
in participant remote Recv is synced with remote send (without triggering a empty message!).
RemoteRecv Sink will send the sendstream to RemoteSend Drain and it will be used when a first message is send on this stream.
2021-04-29 15:58:39 +02:00
Marcel Märtens
760c382ed9 protocoladdr change for listen and connect
(remove a loop in quic protocol which wasnt a actual loop)
2021-04-29 15:58:34 +02:00
Marcel Märtens
9f0aceba4c work on getting quic in the network 2021-04-29 15:58:26 +02:00
Marcel Märtens
383482a36e Quic: We had the followuing problem:
- locally we open a stream, our local Drain is sending OpenStream
 - remote Sink will know this and notify remote Drain
 - remote side sends a message
 - local sink does not know about the Stream. as there is (and CANT) be a wat to notify local Sink from local Drain (it could introduce race conditions).

One of the possible solutions was, that the remote drain will copy the OpenStream Msg ON the Quic::stream before first data is send. This would work but is complicated.

Instead we now just mark such streams as "potentially open" and we listen for the first DataHeader to get it's SID.

add support for unreliable messages in quic protocol, benchmarks
2021-04-29 15:58:23 +02:00
Ben Wallis
2e08c2f76f Added client/server version mismatch message when a network error is encountered during client init.
Added warning banner on character select when successfully connected to a server with a mismatched version.
2021-04-24 09:08:30 +01:00
Marcel Märtens
8ee83df600 fixed #1067 2021-04-13 20:39:56 +02:00
Marcel Märtens
ea5a02d7cd change some Ordering::Relaxed to Ordering::SeqCst when we do not want to have it moved/or taken effects from other threads.
some id increases are kept Relaxed, SeqCst shouldn't be necessary there.
Not sure about the bool checks in api.rs
2021-04-07 23:17:09 +02:00
Marcel Märtens
7ca2f3b9d6 make a panic a error! and improve logging 2021-04-03 19:58:36 +02:00
Marcel Märtens
c77446a014 fix some tracy only and no default features 2021-03-27 18:24:10 +01:00
Marcel Märtens
6a95fb6b74 extend network of incomming TCP metrics and failed handshake metric 2021-03-27 18:24:10 +01:00
Marcel Märtens
aea52d8b54 implement Upload Bandwidth prediction.
Its available to `api` and `metrics` and can be used to slow down msg send in veloren.
It uses a tokio::watch for now, as i plan to have a watch job in the scheduler that recalculates prio on change.
Also cleaning up participant metrics after a disconnect
2021-03-26 08:58:03 +01:00
Marcel Märtens
034d0f0c5d fix a bug that some closes could get lost 2021-03-26 08:57:56 +01:00
Marcel Märtens
8dccc21125 preparation for multiple-channel participants.
When a stream is opened we are searching for the best (currently) available channel.
The stream will then be keept on that channel.
Adjusted the rest of the algorithms that they now respect this rule.
improved a HashMap for Pids to be based on a Vec. Also using this for Sid -> Cid relation which is more performance critical
WARN: our current send()? error handling allows it for some close_stream messages to get lost.
2021-03-26 08:57:50 +01:00
Marcel Märtens
01c82b70ab network scheduler and rawmsg cleanup 2021-03-26 08:57:42 +01:00
Marcel Märtens
6b23101fac update toolchain to nightly-2021-03-22 2021-03-22 16:41:04 +01:00
Marcel Märtens
9084ac48f1 defer some trace, so that we wont spam the log. 2021-03-22 09:16:07 +01:00
Marcel Märtens
9028578bc8 Change the way Network is dropped.
Instead of keeping Runtime and manually spawn a task on `drop` this task is spawned at start and will wait to be triggered.
The `drop` methods then wait for completion, UNLESS they are in a async context, then they MUST NOT BLOCK (deadlock potential), so they defer it to the Runtime and HOPE for the runtime to exist long enough.
This get rid of the weird `block_in_place` which is only accessable with `rt-multi-threaded` and has some disadvantages.
We also wont requiere the runtime to be active all the time. Though its needed for a clean shutdown
2021-03-03 11:28:40 +01:00
Marcel Märtens
44817870ee Shutdown improvements
- Timeout for Participant::drop, it will stop eventually
 - Detect tokio runtime in Participant::drop and no longer use std::sleep in that case (it could hang the thread that is actually doing the shutdown work and deadlock
 - Parallel Shutdown in Scheduler: Instead of a slow shutdown locking up everything we can now shutdown participants in parallel, this should reduces `WARN` part took long for shutdown dramatically
2021-02-26 10:50:30 +01:00