Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
637 commits
Select commit Hold shift + click to select a range
8da5215
enhanced the basic performance test tool
dorkbox Jul 23, 2023
e578655
Updated version
dorkbox Jul 24, 2023
53cd6ac
Tweaks for testing performance
dorkbox Jul 24, 2023
2e904b8
Tweaks for testing performance
dorkbox Jul 24, 2023
16c8386
Updated API for collections
dorkbox Aug 5, 2023
4a80c2c
Reconnect now can have a specified timeout
dorkbox Aug 5, 2023
00dffa7
Updated for new config project
dorkbox Aug 5, 2023
72b4c93
Removed moshi, updated deps
dorkbox Aug 5, 2023
ae08ff2
Updated classutils
dorkbox Aug 5, 2023
b7f4a09
Updated classutils
dorkbox Aug 5, 2023
1c8b9d5
removed upstream dependency (no longer needed)
dorkbox Aug 6, 2023
342abd4
updated deps
dorkbox Aug 6, 2023
ac42a8b
updated deps
dorkbox Aug 6, 2023
08d58fd
Fixed issues with recursive aeron directory name
dorkbox Aug 7, 2023
6dc7e6b
If we close the event poller WHILE ON the event poller, re-dispatch t…
dorkbox Aug 8, 2023
4d2de08
Added data success checks when streaming messages.
dorkbox Aug 8, 2023
59bc934
moved checks to earlier in the connect process
dorkbox Aug 8, 2023
8aa919b
simplified connect redispatch logic
dorkbox Aug 8, 2023
296c600
Added more detailed info when reconnecing
dorkbox Aug 8, 2023
9a30c03
Added extra checks when adding pub/sub for when there is an ERRORED s…
dorkbox Aug 8, 2023
eaafc0f
reset the endpoint config (not the initial config) when resetting.
dorkbox Aug 9, 2023
9fcbabd
cleaned up logging
dorkbox Aug 10, 2023
3dcd2af
Moved aeron.send() logic to the driver
dorkbox Aug 10, 2023
28d170c
Added support for detecting critical driver errors
dorkbox Aug 10, 2023
db385d0
inUse check now uses the endpoint for extra checks
dorkbox Aug 10, 2023
a7533d2
closed check is now volatile
dorkbox Aug 10, 2023
4c31350
driver.close method cleanup
dorkbox Aug 10, 2023
e9f7172
code polish for event poller
dorkbox Aug 10, 2023
3852677
connect event dispatch check only redispatches when it's ON the EDT, …
dorkbox Aug 10, 2023
836c8ab
Cleaned up/tweaked endpoint.close()
dorkbox Aug 10, 2023
6e76160
changed config.id -> mediaDriverId()
dorkbox Aug 10, 2023
d9bac74
added endpoint to inUse()
dorkbox Aug 10, 2023
ce311fe
Added more support for criticalDriverErrors
dorkbox Aug 10, 2023
e2b5f52
AddError is no longer suspending
dorkbox Aug 10, 2023
4d73d48
cleaned up imports
dorkbox Aug 10, 2023
96cd987
config.id -> mediaDriverId()
dorkbox Aug 10, 2023
90d2186
Cleaned up how new aeron drivers are created
dorkbox Aug 10, 2023
19b36bd
driver.start/close are now reentrant
dorkbox Aug 10, 2023
1ded010
code cleanup
dorkbox Aug 10, 2023
2b5e943
can optionally notifyDisconnect when closing a connection
dorkbox Aug 10, 2023
07e1da3
Tweaked how waiting for close works
dorkbox Aug 10, 2023
def9352
comment cleanup
dorkbox Aug 10, 2023
50ab7fc
config.id -> mediaDriverId()
dorkbox Aug 10, 2023
b8a6f54
Updated API for unittests
dorkbox Aug 10, 2023
91aed61
updated license
dorkbox Aug 10, 2023
a36947a
updated deps
dorkbox Aug 10, 2023
77d56b8
Direct access to critical error now instead of proxy
dorkbox Aug 11, 2023
4663639
code cleanup
dorkbox Aug 11, 2023
ad97712
driver endpoint list is now concurrent
dorkbox Aug 11, 2023
96f5406
More careful checks when closing endpoints during restart
dorkbox Aug 11, 2023
8e7c47a
code cleanup
dorkbox Aug 11, 2023
95b1b44
Only set the send/recv buffer sizes if they have been configured
dorkbox Aug 11, 2023
e8724ea
Client connections are checked for isConnected() status during poll e…
dorkbox Aug 11, 2023
b39db65
code polish
dorkbox Aug 11, 2023
c856c23
Server connections are checked for isConnected() status during poll e…
dorkbox Aug 11, 2023
c95e811
version 6.7
dorkbox Aug 11, 2023
bdfc293
updated gradle
dorkbox Aug 20, 2023
6df290c
updated deps
dorkbox Aug 20, 2023
87173af
version 6.8
dorkbox Aug 20, 2023
0747802
updated deps, version 6.9
dorkbox Aug 21, 2023
b639ec1
UDP frame size information moved to startup.
dorkbox Aug 21, 2023
364b29f
version 6.9.1
dorkbox Aug 21, 2023
f631dea
If reconnect is called on a client WITHOUT being first closed, it wil…
dorkbox Aug 30, 2023
620e74a
Added package-info.java
dorkbox Sep 3, 2023
4d2ee10
fixed error in logic for unit test
dorkbox Sep 3, 2023
ac2cf56
code cleanup
dorkbox Sep 3, 2023
e7999d3
WIP - removing heap allocations
dorkbox Sep 3, 2023
6291e1a
ResponseManager uses its own, internal dispatcher for events
dorkbox Sep 3, 2023
e185f49
Removed coroutines/suspending calls
dorkbox Sep 3, 2023
8b62dbb
Removed more coroutine, simplified methods
dorkbox Sep 4, 2023
2d06122
Cleaned up how errors are managed
dorkbox Sep 5, 2023
769bad6
tweaked function names and timeouts
dorkbox Sep 5, 2023
d64a4bb
Moved ping() to the connection object
dorkbox Sep 5, 2023
1b2487d
Error notifications have their own dispatcher now (and it's in the Li…
dorkbox Sep 5, 2023
effed36
Server Handshake has its own dispatcher, and its in the HandshakePoll…
dorkbox Sep 5, 2023
3e9a8f9
Moved ping to the connection object
dorkbox Sep 5, 2023
7c326d1
Converted the RMI response manager to use blocking instead of suspend…
dorkbox Sep 5, 2023
3704ae2
RmiUtils now accepts `Throwable` instead of `Exception`
dorkbox Sep 5, 2023
48f1555
Removed unnecessary Suspend Trampoline
dorkbox Sep 5, 2023
ae5a48b
Added back a/syncSuspend
dorkbox Sep 5, 2023
26e6da5
Now catch and watch `Throwable` instead of just `Exception`
dorkbox Sep 5, 2023
464fbad
Removed coroutine trampoline from JPMS
dorkbox Sep 6, 2023
b30b024
Added readKryos for streaming
dorkbox Sep 6, 2023
0bd725b
Removed withKryo{} lambda (was causing heap issues)
dorkbox Sep 6, 2023
54eab9d
code cleanup
dorkbox Sep 6, 2023
c5b9691
Moved dispatcher to EventDispatcher
dorkbox Sep 6, 2023
2a485bd
code cleanup
dorkbox Sep 6, 2023
9b1650a
Code cleanup
dorkbox Sep 6, 2023
cbb5038
code cleanup
dorkbox Sep 6, 2023
9e20a20
Streaming data now supports random placement
dorkbox Sep 6, 2023
7ac284b
Code cleanup
dorkbox Sep 6, 2023
94ae227
Fixed issues with heap garbage generation and performance (suspend is…
dorkbox Sep 6, 2023
e11287b
Converted to executors.
dorkbox Sep 6, 2023
0173ef7
GC performance optimization
dorkbox Sep 6, 2023
63dd140
Converted to using threads instead of coroutines
dorkbox Sep 6, 2023
1bb052f
comments fixed
dorkbox Sep 6, 2023
94b5226
Fixed issues with RMI not throwing exceptions properly
dorkbox Sep 7, 2023
ba4df9b
Comments
dorkbox Sep 7, 2023
9d0d8ef
Initial value of threadID is 0, so we don't have to initialize the po…
dorkbox Sep 7, 2023
8428d98
Enable to dynamically enable IPC when explicitly called
dorkbox Sep 7, 2023
a85c647
Updated collections to use LongMap
dorkbox Sep 7, 2023
2e8382e
removed debug code
dorkbox Sep 7, 2023
56a42e5
comments
dorkbox Sep 7, 2023
fa03be5
various steps to optimize RMI calls (they are ~1.5x as slow as standa…
dorkbox Sep 7, 2023
df11e40
Moved all `app` non-unit test code into the app package
dorkbox Sep 7, 2023
daf289c
updated deps
dorkbox Sep 7, 2023
2aef58b
version 6.10
dorkbox Sep 7, 2023
c2c45b9
updated deps
dorkbox Sep 7, 2023
d772088
Streaming data now goes onto its own context instead of on the aeron …
dorkbox Sep 7, 2023
50f212b
updated deps
dorkbox Sep 7, 2023
e3a565f
Fixed issues with streaming (it MUST be the aeron thread)
dorkbox Sep 8, 2023
f9b3001
RMI fix/cleanup
dorkbox Sep 8, 2023
78ae3a3
Added unit test for closing endpoint while they haven't fully started
dorkbox Sep 8, 2023
dafcc97
cleanStackTrace() now returns itself.
dorkbox Sep 8, 2023
c69512e
pollerClosedLatch is now only created once we've fully started (preve…
dorkbox Sep 8, 2023
3d8c527
Better error details during connect phase
dorkbox Sep 8, 2023
3abbdf8
removed stacktrace output
dorkbox Sep 8, 2023
8e9e044
Fixed issue with with RMI sync/async.
dorkbox Sep 13, 2023
3fff697
Only notify exceptions when message-send-during-close, when we did no…
dorkbox Sep 13, 2023
d895e04
Fixed issues with streaming for RMI and added another streaming test
dorkbox Sep 13, 2023
81380fe
Wrapped logger.debug/trace into if statements to prevent the JVM from…
dorkbox Sep 13, 2023
5021eb5
made read accessible
dorkbox Sep 13, 2023
560b5bc
Fixed issue with trace logging + RMI when arguments were large
dorkbox Sep 13, 2023
b2b6cfd
Removed KotlinLogging (it has a niche usage that did not apply)
dorkbox Sep 13, 2023
00a1f4c
Limit logging messages for RMI when args are long.
dorkbox Sep 14, 2023
67b4443
Ensure the aeron context is always closed and the driver is cleaned u…
dorkbox Sep 14, 2023
5b43d44
Initial work on cache
dorkbox Sep 15, 2023
e32ecda
updated dep
dorkbox Sep 15, 2023
f269684
newConnection method reverted back to function, which allows for easi…
dorkbox Sep 17, 2023
b2d349d
Merge branch 'session'
dorkbox Sep 17, 2023
851fcfd
Code cleanup
dorkbox Sep 17, 2023
c804798
removed unnecessary dir
dorkbox Sep 19, 2023
3e9109b
Code cleanup
dorkbox Sep 21, 2023
e6b4cbd
Added support for sessions
dorkbox Sep 21, 2023
19d6d6e
Code cleanup
dorkbox Sep 21, 2023
1125785
added unit test for sessions
dorkbox Sep 21, 2023
c0227fe
Updated deps, now pure support for jpms
dorkbox Sep 21, 2023
8bbaa6d
Cleaned up sessions
dorkbox Sep 22, 2023
be78d49
Add connection before init, so init happens before polling of events
dorkbox Sep 25, 2023
2ab8d7b
Added comments
dorkbox Sep 25, 2023
e399f49
Stronger checks for RMI ID minimum values
dorkbox Sep 25, 2023
72a7121
More clear logging
dorkbox Sep 25, 2023
8dd70e9
Cleaned up comments
dorkbox Sep 25, 2023
00d444b
Fixed out-of-order signalling
dorkbox Sep 25, 2023
babee06
Fixed issues surrounding RMI + timeouts
dorkbox Sep 25, 2023
1b6880b
Fixed issues when deleting RMI objects/proxies
dorkbox Sep 25, 2023
b2217f6
Added additional cast method
dorkbox Sep 25, 2023
78374e4
More clearly defined session management. Fixed problem when reconnect…
dorkbox Sep 25, 2023
b45826d
Code cleanup + better unit tests
dorkbox Sep 25, 2023
653236a
version 6.11
dorkbox Sep 25, 2023
b55168a
Now safely try to close a connection when it's not possible (just log…
dorkbox Sep 26, 2023
0825274
Cleaned up ordering of connection initialization
dorkbox Sep 27, 2023
c69a33f
version 6.12
dorkbox Sep 27, 2023
1287eb8
AeronDriverInternal will now restart the network if there is an `unex…
dorkbox Oct 3, 2023
1fded55
updated build deps
dorkbox Oct 3, 2023
48325ee
version 6.13
dorkbox Oct 3, 2023
8f9ee52
Fixed null pointer
dorkbox Oct 5, 2023
7eac969
Fixed session/connection lateinit errors
dorkbox Oct 5, 2023
66a922b
Increased default macos devShm virtual drive
dorkbox Oct 5, 2023
decec86
updated license
dorkbox Oct 5, 2023
c62016d
version 6.14
dorkbox Oct 5, 2023
53f7cd8
Simplified connection log info for debug output
dorkbox Oct 17, 2023
3a69d1a
updated build deps
dorkbox Oct 17, 2023
ee296c6
updated gradle
dorkbox Oct 17, 2023
4d09999
Updated logging
dorkbox Oct 17, 2023
047d938
Safely attempt to close the settings store (permissions might not all…
dorkbox Oct 17, 2023
099f9de
Enhanced logging for session connection type
dorkbox Oct 18, 2023
de6d22f
Added logs when closing storage
dorkbox Oct 18, 2023
46cb174
more logging
dorkbox Oct 18, 2023
2a8ac38
ResponseManager now uses a special TimeoutException instead of generi…
dorkbox Oct 18, 2023
d4e3e2e
Better/easier checking if we are a session or not
dorkbox Oct 18, 2023
2245f0b
more comments
dorkbox Oct 18, 2023
6fb5dbb
added sendDisconnectMessage to API when closing
dorkbox Oct 18, 2023
d51c878
Fixed cast exception with sessions
dorkbox Oct 18, 2023
7cacc63
renamed function: isConnected -> isClosedWithTimeout
dorkbox Oct 18, 2023
c38fa13
More careful return values when adding data to aeron buffer
dorkbox Oct 18, 2023
cfc08a2
SessionManager expiration now using the correct expire time
dorkbox Oct 18, 2023
a15478c
modified delayLingerTimeout() to be more intelligent with regards to …
dorkbox Oct 18, 2023
0e16747
logging
dorkbox Oct 19, 2023
83a9a57
Connection timeout is based from when connection is created
dorkbox Oct 19, 2023
d40c080
API parameter clarification
dorkbox Oct 19, 2023
01ab0bf
Properly cleanup the remote object storage/cache
dorkbox Oct 23, 2023
706cf5b
Fixed edge case with session connections and sending data on a public…
dorkbox Oct 23, 2023
2270b81
better logging
dorkbox Oct 23, 2023
14544d3
Removed delayed close from event poller
dorkbox Oct 24, 2023
4906e94
Code cleanup
dorkbox Oct 24, 2023
90d0870
Added for remote server testing
dorkbox Oct 24, 2023
044ce87
Fixed sigint close command issues
dorkbox Oct 24, 2023
60a2620
Added extra debug info
dorkbox Oct 24, 2023
8c2b6b3
wait for close is not explicitly necessary
dorkbox Oct 24, 2023
59d17ea
Better logic for unit test
dorkbox Oct 24, 2023
495cb95
cleanAllStackTrace() returns itself
dorkbox Oct 24, 2023
4b58a63
Added extra (general) log message when a network error occurs
dorkbox Oct 24, 2023
7082570
More careful event dispatch (no longer global, but per endpoint)
dorkbox Oct 26, 2023
9d303be
Better session management + logs
dorkbox Oct 26, 2023
d7884c4
Updated logs
dorkbox Oct 26, 2023
7f2ad97
code cleanup and comments
dorkbox Oct 26, 2023
f531f61
Better support for polling and sending dc message
dorkbox Oct 26, 2023
737b685
Wrapped potential RMI errors in exception catching
dorkbox Oct 26, 2023
046ece1
code polish
dorkbox Oct 26, 2023
1b235e2
waiting for endpoint to shutdown better supports restarts
dorkbox Oct 26, 2023
ba57447
fixed connect notify
dorkbox Oct 26, 2023
0c4c442
Fixed/cleaned up connection polling and restarts
dorkbox Oct 26, 2023
27b4b04
disabled test debug
dorkbox Oct 26, 2023
fe98763
All connections are now buffered - in the event there is a network is…
dorkbox Oct 28, 2023
58535a9
Added support for connection tags (so the client can set a name for i…
dorkbox Oct 28, 2023
91deea8
Added support for callbacks on a message, so there can be 'happens-be…
dorkbox Nov 2, 2023
2162131
updated shadowclass file
dorkbox Nov 2, 2023
f40e8cf
More detailed error message
dorkbox Nov 3, 2023
af19049
Added multi-dispatch, for on the server when conducting handshakes (a…
dorkbox Nov 3, 2023
a528689
When creating publications and handshaking, we CANNOT do this on the …
dorkbox Nov 3, 2023
4bd7751
Increased connection timeouts.
dorkbox Nov 3, 2023
2aebbe6
Added more logging
dorkbox Nov 8, 2023
cbfe51f
Added Handshake dispatch (was required, and must be single threaded)
dorkbox Nov 13, 2023
8e32e09
Shutdown is now atomic instead of volatile
dorkbox Nov 13, 2023
bae5b41
disconnect period is as short as possible to improve unit test perfor…
dorkbox Nov 13, 2023
35020ad
Updated to 100 concurrent connections (on 50 separate threads)
dorkbox Nov 13, 2023
644d28e
Any exceptions will cause a unit test failure now
dorkbox Nov 13, 2023
d4fd773
spaces
dorkbox Nov 13, 2023
f0493be
updated minlog
dorkbox Nov 13, 2023
88bac6e
Version 6.15
dorkbox Nov 16, 2023
76f42c9
Guarantee that connect occurs AFTER the current close events are fini…
dorkbox Nov 22, 2023
2cfc2e4
Make sure now that errors during unit tests are properly failing (or …
dorkbox Nov 22, 2023
b496f83
100 concurrent connections in a unit tests kills the machine.
dorkbox Nov 22, 2023
a1db866
updated deps
dorkbox Nov 22, 2023
13e8501
Commented out remaining logic for connection rules (not impl yet)
dorkbox Nov 27, 2023
f1a06fd
Better comments/docs
dorkbox Nov 27, 2023
bf0cd3f
Added support for PER-CONNECTION buffering of messages (default is en…
dorkbox Nov 27, 2023
cf2e7ff
Removed exception stacktrace during reconnect
dorkbox Nov 27, 2023
41b3acf
Fixed api name
dorkbox Nov 27, 2023
5c4d64f
fixed up comments
dorkbox Nov 28, 2023
3a5295e
Cleaned logging
dorkbox Nov 28, 2023
2c9d3c1
Updated build deps
dorkbox Nov 28, 2023
b9f7a55
update license
dorkbox Nov 28, 2023
cb7f8b2
Send all buffered messages at once, instead of 1-at-a-time.
dorkbox Dec 4, 2023
cdc056f
logging tweak
dorkbox Dec 4, 2023
6bbf62f
Added more unit tests for aeron connectivity
dorkbox Dec 4, 2023
6f50618
Now properly waits for event dispatcher to shutdown in unit tests
dorkbox Dec 4, 2023
db15b62
Added more unit tests, increased multi-threading for mutli-client uni…
dorkbox Dec 4, 2023
9c2fa4b
updated logging
dorkbox Dec 12, 2023
331f921
Added extra information for handshake/connection timeout potential is…
dorkbox Dec 12, 2023
98d8321
updated config comments
dorkbox Dec 12, 2023
a706cdb
If we have "max connections" specified, then obey the limit
dorkbox Dec 12, 2023
e80cc93
Use ThreadSafe publication instead of exclusive publication
dorkbox Dec 12, 2023
bd64760
ConnectionCounts are now threadsafe
dorkbox Dec 12, 2023
e4721b4
fixed typo
dorkbox Dec 14, 2023
4fc0cb7
fixed comments
dorkbox Jan 15, 2024
0500de2
updated copyright
dorkbox Feb 5, 2024
c197a2f
logging
dorkbox Feb 5, 2024
3f77af5
More responsive shutdown logic during handshake and fixed crashes whe…
dorkbox Feb 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,467 changes: 971 additions & 1,496 deletions LICENSE

Large diffs are not rendered by default.

373 changes: 373 additions & 0 deletions LICENSE.MPLv2

Large diffs are not rendered by default.

107 changes: 42 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,66 @@
Network
=======

###### [![Dorkbox](https://badge.dorkbox.com/dorkbox.svg "Dorkbox")](https://git.dorkbox.com/dorkbox/Network) [![Github](https://badge.dorkbox.com/github.svg "Github")](https://github.com/dorkbox/Network) [![Gitlab](https://badge.dorkbox.com/gitlab.svg "Gitlab")](https://gitlab.com/dorkbox/Network) [![Bitbucket](https://badge.dorkbox.com/bitbucket.svg "Bitbucket")](https://bitbucket.org/dorkbox/Network)
###### [![Dorkbox](https://badge.dorkbox.com/dorkbox.svg "Dorkbox")](https://git.dorkbox.com/dorkbox/Network) [![Github](https://badge.dorkbox.com/github.svg "Github")](https://github.com/dorkbox/Network) [![Gitlab](https://badge.dorkbox.com/gitlab.svg "Gitlab")](https://gitlab.com/dorkbox/Network)


The Network project is an encrypted, high-performance, event-driven/reactive Network stack with DNS and RMI, using Netty, Kryo, KryoNet RMI, and LZ4 via TCP/UDP.
The Network project is an ~~encrypted~~, high-performance, event-driven/reactive Network stack with DNS and RMI, using Aeron, Kryo, KryoNet RMI, ~~encryption and LZ4 via UDP.~~

These are the main features:
* The connection between endpoints is AES256-GCM / EC curve25519. (WIP, this was updated for use with Aeron, which changes this)
* The connection data is LZ4 compressed and byte-packed for small payload sizes. (WIP, this was updated for use with Aeron, which
changes this)
- The connection supports:

~~* The connection between endpoints is AES256-GCM / EC curve25519. (WIP, this was updated for use with Aeron, which changes this)~~
~~* The connection data is LZ4 compressed and byte-packed for small payload sizes. (WIP, this was updated for use with Aeron, which
changes this)~~
### The connection supports:
- Sending object (via the Kryo serialization framework)
- Sending arbitrarily large objects
- Remote Method Invocation
- Blocking
- Non-Blocking
- Void returns
- Exceptions can be returned
- Kotlin coroutine suspend functions
- Sending data when Idle
- ~~Sending data when Idle~~
- "Pinging" the remote end (for measuring round-trip time)
- Firewall connections by IP+CIDR
- Specify the connection type (nothing, compress, compress+encrypt)
- ~~Specify the connection type (nothing, compress, compress+encrypt)~~

- The available transports is UDP

- The available transports are TCP and UDP
- There are simple wrapper classes for:
- Server
- Client
* MultiCast Broadcast client and server discovery (WIP, this was updated for use with Aeron, which changes this)


- Note: There is a maximum packet size for UDP, 508 bytes *to guarantee it's unfragmented*

- This is for cross-platform use, specifically - linux 32/64, mac 64, and windows 32/64. Java 1.8+
- This is for cross-platform use, specifically - linux 32/64, mac 64, and windows 32/64. Java 1.11+
- This library is designed to be used with kotlin, specifically the use of coroutines.

``` java
public static
class AMessage {
public
AMessage() {
}
val configurationServer = ServerConfiguration()
configurationServer.settingsStore = Storage.Memory() // don't want to persist anything on disk!
configurationServer.port = 2000
configurationServer.enableIPv4 = true

val server: Server<Connection> = Server(configurationServer)

server.onMessage<String> { message ->
logger.error("Received message '$message'")
}

KryoCryptoSerializationManager.DEFAULT.register(AMessage.class);

Configuration configuration = new Configuration();
configuration.tcpPort = tcpPort;
configuration.host = host;

final Server server = new Server(configuration);
addEndPoint(server);
server.bind(false);

server.listeners()
.add(new Listener<AMessage>() {
@Override
public
void received(Connection connection, AMessage object) {
System.err.println("Server received message from client. Bouncing back.");
connection.send()
.TCP(object);
}
});

Client client = new Client(configuration);
client.disableRemoteKeyValidation();
addEndPoint(client);
client.connect(5000);

client.listeners()
.add(new Listener<AMessage>() {
@Override
public
void received(Connection connection, AMessage object) {
ClientSendTest.this.checkPassed.set(true);
System.err.println("Tada! It's been bounced back.");
server.stop();
}
});

client.send()
.TCP(new AMessage());
server.bind()



val configurationClient = ClientConfiguration()
configurationClient.settingsStore = Storage.Memory() // don't want to persist anything on disk!
configurationClient.port = 2000

val client: Client<Connection> = Client(configurationClient)

client.onConnect {
send("client test message")
}

client.connect()

```


&nbsp;
&nbsp;

Expand All @@ -95,7 +72,7 @@ Maven Info
<dependency>
<groupId>com.dorkbox</groupId>
<artifactId>Network</artifactId>
<version>5.32</version>
<version>6.15</version>
</dependency>
</dependencies>
```
Expand All @@ -105,11 +82,11 @@ Gradle Info
```
dependencies {
...
implementation("com.dorkbox:Network:5.32")
implementation("com.dorkbox:Network:6.15")
}
```

License
---------
This project is © 2021 dorkbox llc, and is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further
This project is © 2023 dorkbox llc, and is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further
references.
152 changes: 92 additions & 60 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020 dorkbox, llc
* Copyright 2023 dorkbox, llc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,8 +14,6 @@
* limitations under the License.
*/

import java.time.Instant

///////////////////////////////
////// PUBLISH TO SONATYPE / MAVEN CENTRAL
////// TESTING : (to local maven repo) <'publish and release' - 'publishToMavenLocal'>
Expand All @@ -25,28 +23,29 @@ import java.time.Instant
gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS // always show the stacktrace!

plugins {
id("com.dorkbox.GradleUtils") version "2.17"
id("com.dorkbox.Licensing") version "2.12"
id("com.dorkbox.VersionUpdate") version "2.5"
id("com.dorkbox.GradlePublish") version "1.12"
id("com.dorkbox.GradleUtils") version "3.18"
id("com.dorkbox.Licensing") version "2.28"
id("com.dorkbox.VersionUpdate") version "2.8"
id("com.dorkbox.GradlePublish") version "1.22"

id("com.github.johnrengelman.shadow") version "8.1.1"

kotlin("jvm") version "1.6.10"
kotlin("jvm") version "1.9.0"
}

@Suppress("ConstPropertyName")
object Extras {
// set for the project
const val description = "High-performance, event-driven/reactive network stack for Java 11+"
const val group = "com.dorkbox"
const val version = "5.32"
const val version = "6.15"

// set as project.ext
const val name = "Network"
const val id = "Network"
const val vendor = "Dorkbox LLC"
const val vendorUrl = "https://dorkbox.com"
const val url = "https://git.dorkbox.com/dorkbox/Network"

val buildDate = Instant.now().toString()
}

///////////////////////////////
Expand All @@ -60,31 +59,38 @@ GradleUtils.compileConfiguration(JavaVersion.VERSION_11) {
// enable the use of inline classes. see https://kotlinlang.org/docs/reference/inline-classes.html
freeCompilerArgs = listOf("-Xinline-classes")
}
//NOTE: we do not support JPMS yet, as there are some libraries missing support for it still


// ratelimiter, "other" package
//val kotlin = project.extensions.getByType(org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension::class.java).sourceSets.getByName("main").kotlin
//kotlin.apply {
// setSrcDirs(project.files("src"))
// include("**/*.kt") // want to include kotlin files for the source. 'setSrcDirs' resets includes...
//}

// TODO: driver name resolution: https://github.com/real-logic/aeron/wiki/Driver-Name-Resolution
// this keeps us from having to restart the media driver when a connection changes IP addresses

// TODO: virtual threads in java21 for polling?

// if we are sending a SMALL byte array, then we SEND IT DIRECTLY in a more optimized manner (because we can count size info!)
// other side has to be able to parse/know that this was sent directly as bytes. It could be game state data, or voice data, etc.
// another idea is to be able to "send" a stream of bytes (this would also get chunked/etc!). if chunked, these are fixed byte sizes!
// -- the first byte manage: byte/message/stream/etc, no-crypt, crypt, crypt+compress
// - connection.inputStream() --> behaves as an input stream to remote endpoint --> connection.outputStream()
// -- open/close/flush/etc commands also go through
// -- this can be used to stream files/audio/etc VERY easily
// -- have a createInputStream(), which will cause the outputStream() on the remote end to be created.
// --- this remote outputStream is a file, raw??? this is setup by createInputStream() on the remote end
// - state-machine for kryo class registrations?

// ratelimiter, "other" package, send-on-idle
// rest of unit tests
// getConnectionUpgradeType
// ability to send with a function callback (using RMI waiter type stuff for callbacks)
// use conscrypt?!

// java 14 is faster with aeron!
// NOTE: now using aeron instead of netty
// todo: remove BC! use conscrypt instead, or native java? (if possible. we are java 11 now, instead of 1.6)


// also, NOT using bouncastle, but instead the google one
// better SSL library
// implementation("org.conscrypt:conscrypt-openjdk-uber:2.2.1")
// init {
// try {
// Security.insertProviderAt(Conscrypt.newProvider(), 1);
// }
// catch (e: Throwable) {
// e.printStackTrace();
// }
// }


licensing {
Expand Down Expand Up @@ -134,66 +140,92 @@ tasks.jar.get().apply {
attributes["Specification-Vendor"] = Extras.vendor

attributes["Implementation-Title"] = "${Extras.group}.${Extras.id}"
attributes["Implementation-Version"] = Extras.buildDate
attributes["Implementation-Version"] = GradleUtils.now()
attributes["Implementation-Vendor"] = Extras.vendor
}
}


val shadowJar: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar by tasks
shadowJar.apply {
manifest.inheritFrom(tasks.jar.get().manifest)

manifest.attributes.apply {
put("Main-Class", "dorkboxTest.network.app.AeronClientServerForever")
}

mergeServiceFiles()

duplicatesStrategy = DuplicatesStrategy.INCLUDE

from(sourceSets.test.get().output)
configurations = listOf(project.configurations.testRuntimeClasspath.get())

archiveBaseName.set(project.name + "-all")
}


dependencies {
api("org.jetbrains.kotlinx:atomicfu:0.17.3")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
api("org.jetbrains.kotlinx:atomicfu:0.23.0")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")

// https://github.com/dorkbox
api("com.dorkbox:ByteUtilities:1.5")
api("com.dorkbox:Collections:1.1")
api("com.dorkbox:MinLog:2.4")
api("com.dorkbox:NetworkDNS:2.7.1")
api("com.dorkbox:NetworkUtils:2.18")
api("com.dorkbox:ObjectPool:4.0")
api("com.dorkbox:OS:1.0")
api("com.dorkbox:Serializers:2.7")
api("com.dorkbox:Storage:1.1")
api("com.dorkbox:ByteUtilities:2.1")
api("com.dorkbox:ClassUtils:1.3")
api("com.dorkbox:Collections:2.7")
api("com.dorkbox:HexUtilities:1.1")
api("com.dorkbox:JNA:1.4")
api("com.dorkbox:MinLog:2.7")
api("com.dorkbox:NetworkDNS:2.16")
api("com.dorkbox:NetworkUtils:2.23")
api("com.dorkbox:OS:1.11")
api("com.dorkbox:Serializers:2.9")
api("com.dorkbox:Storage:1.11")
api("com.dorkbox:Updates:1.1")
api("com.dorkbox:Utilities:1.29")
api("com.dorkbox:Utilities:1.48")


// how we bypass using reflection/jpms to access fields for java17+
api("org.javassist:javassist:3.29.2-GA")


val jnaVersion = "5.13.0"
api("net.java.dev.jna:jna-jpms:${jnaVersion}")
api("net.java.dev.jna:jna-platform-jpms:${jnaVersion}")


// we include ALL of aeron, in case we need to debug aeron behavior
// https://github.com/real-logic/aeron
val aeronVer = "1.38.1"
api("io.aeron:aeron-all:$aeronVer")
// api("io.aeron:aeron-client:$aeronVer")
// api("io.aeron:aeron-driver:$aeronVer")
val aeronVer = "1.42.1"
api("io.aeron:aeron-driver:$aeronVer")
// ALL of aeron, in case we need to debug aeron behavior
// api("io.aeron:aeron-all:$aeronVer")
// api("org.agrona:agrona:1.18.2") // sources for this aren't included in aeron-all!

// https://github.com/EsotericSoftware/kryo
api("com.esotericsoftware:kryo:5.3.0") {
api("com.esotericsoftware:kryo:5.5.0") {
exclude("com.esotericsoftware", "minlog") // we use our own minlog, that logs to SLF4j instead
}

// https://github.com/jpountz/lz4-java
// implementation("net.jpountz.lz4:lz4:1.3.0")

// this is NOT the same thing as LMAX disruptor.
// This is just a slightly faster queue than LMAX. (LMAX is a fast queue + other things w/ a difficult DSL)
// https://github.com/conversant/disruptor_benchmark
// https://www.youtube.com/watch?v=jVMOgQgYzWU
//api("com.conversantmedia:disruptor:1.2.19")
// https://github.com/lz4/lz4-java
api("org.lz4:lz4-java:1.8.0")

// https://github.com/jhalterman/typetools
api("net.jodah:typetools:0.6.3")

// Expiring Map (A high performance thread-safe map that expires entries)
// https://github.com/jhalterman/expiringmap
api("net.jodah:expiringmap:0.5.10")
api("net.jodah:expiringmap:0.5.11")

// https://github.com/MicroUtils/kotlin-logging
api("io.github.microutils:kotlin-logging:2.1.23")
api("org.slf4j:slf4j-api:1.8.0-beta4")

// api("io.github.microutils:kotlin-logging:3.0.5")
implementation("org.slf4j:slf4j-api:2.0.9")



testImplementation("junit:junit:4.13.2")
testImplementation("ch.qos.logback:logback-classic:1.3.0-alpha4")
testImplementation("ch.qos.logback:logback-classic:1.4.5")
testImplementation("io.aeron:aeron-all:$aeronVer")

testImplementation("com.dorkbox:Config:2.1")
}

publishToSonatype {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading