Commit f1e142b
committed
Incorporated ENet (reliable UDP protocol)
For maximum backwards compatibility, RoRnet version was bumped, SocketW is kept and server still listens for TCP connections on ip/port advertised on master server. Integration with master server is unchanged. Client version check is also unchanged. Only if client version matches, the server instructs the client to reconnect using ENet (using pre-existing unused RoRnet message MSG2_VERSION).
ENet communication is exactly the same as legacy TCP connection, with only one cosmetic detail - server info is sent to client using pre-existing unused RoRnet message MSG2_SERVER_SETTINGS rather than MSG2_HELLO. Server listens for ENet connections on the same IP as TCP and port+1.
This is a prototype done with minimum code changes, for easy understanding. Breakdown:
* listener.cpp (class Listner) - removed all TCP connection handling except version check and master server info query. Compatible clients are instructed to reconnect via ENet.
* dispatcher_enet.h/cpp (class DispatcherENet) - took over all connection handling logic from legacy Listener, except master server integration. Client version is checked again.
* sequencer.h/cpp (class User) - removed TCP socket and send/recv threads (classes Broadcaster, Receiver), deleted "FLOW mode" system ('m_is_receiving_data' flag and `SetReceiveData()` func - related to recv thrad). Added ENetPeer and DispatcherENet. Created function `MessageReceived()` which processes all incoming packets for this user, including intial HELLO.
* receiver.h/cpp (class Receiver) - deleted tcp recv thread, replaced by ENet.
* broadcaster.h/cpp (class Broadcaster) - deleted tcp send thread, replaced by ENet.
* sequencer.h/cpp (class Sequencer) - deleted killer thread and crash statistics, useless with ENet. Deleted "FLOW mode" system (function `enableFlow()` - related to send/recv threads). Function `createClient()` changed to `registerClient()` because the client object is now created early inside DispatcherENet.
* rorserver.cpp - use new DispatcherEnet, keep existing Listener1 parent cf182ea commit f1e142b
File tree
14 files changed
+462
-753
lines changed- source
- protocol
- server
14 files changed
+462
-753
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
This file was deleted.
This file was deleted.
0 commit comments