]> git.seodisparate.com - UDPConnection/log
UDPConnection
9 months agoUpdate README.md
Stephen Seo [Sat, 13 Jul 2024 02:42:53 +0000 (11:42 +0900)]
Update README.md

9 months agoUpdate README.md 1.0
Stephen Seo [Fri, 12 Jul 2024 07:39:43 +0000 (16:39 +0900)]
Update README.md

9 months agoAdd link to published conan package
Stephen Seo [Fri, 12 Jul 2024 07:38:13 +0000 (16:38 +0900)]
Add link to published conan package

9 months agoRework unit-tests to not use GTest
Stephen Seo [Fri, 12 Jul 2024 06:52:53 +0000 (15:52 +0900)]
Rework unit-tests to not use GTest

14 months agoHave forgejo action/workflow use "any_archLinux"
Stephen Seo [Mon, 22 Jan 2024 02:12:58 +0000 (11:12 +0900)]
Have forgejo action/workflow use "any_archLinux"

15 months agostd::atomic doesn't need volatile
Stephen Seo [Sun, 14 Jan 2024 01:31:38 +0000 (10:31 +0900)]
std::atomic doesn't need volatile

15 months agoReduce verbosity of unit test logs
Stephen Seo [Fri, 12 Jan 2024 07:36:01 +0000 (16:36 +0900)]
Reduce verbosity of unit test logs

15 months agoAllow move for TSLQIter
Stephen Seo [Fri, 12 Jan 2024 07:32:42 +0000 (16:32 +0900)]
Allow move for TSLQIter

Should fix builds of UDPConnection.cpp with "-std=c++11".

15 months agoGithub action: ensure current ref is checked out
Stephen Seo [Fri, 12 Jan 2024 05:31:36 +0000 (14:31 +0900)]
Github action: ensure current ref is checked out

15 months agoUse apt-get, add libsodium dep to github action
Stephen Seo [Fri, 12 Jan 2024 05:29:49 +0000 (14:29 +0900)]
Use apt-get, add libsodium dep to github action

15 months agoAdd Github action to run UnitTests
Stephen Seo [Fri, 12 Jan 2024 05:26:11 +0000 (14:26 +0900)]
Add Github action to run UnitTests

15 months agoAdd action/workflow to run UnitTest
Stephen Seo [Fri, 12 Jan 2024 05:06:14 +0000 (14:06 +0900)]
Add action/workflow to run UnitTest

15 months agoAdd UnitTest file for CXX11_shared_spin_lock
Stephen Seo [Fri, 12 Jan 2024 04:55:28 +0000 (13:55 +0900)]
Add UnitTest file for CXX11_shared_spin_lock

15 months agoTweak compare_exchange_weak(...) in spin-lock
Stephen Seo [Tue, 19 Dec 2023 04:47:19 +0000 (13:47 +0900)]
Tweak compare_exchange_weak(...) in spin-lock

15 months agoFix invalid use of mutex in TSLQueue
Stephen Seo [Mon, 23 Oct 2023 06:53:52 +0000 (15:53 +0900)]
Fix invalid use of mutex in TSLQueue

Mutex was removed in favor of the custom SharedSpinLock.

15 months agoDon't fail on "try" fns if failed to get spinLock
Stephen Seo [Thu, 19 Oct 2023 12:07:08 +0000 (21:07 +0900)]
Don't fail on "try" fns if failed to get spinLock

In SharedSpinLock: Only fail on "try" fns after spinLock was acquired
and condition is not met.

15 months agoRefactor shared-spin-lock to use atomic "spinLock"
Stephen Seo [Wed, 18 Oct 2023 13:28:40 +0000 (22:28 +0900)]
Refactor shared-spin-lock to use atomic "spinLock"

15 months agoMinor refactorings
Stephen Seo [Sat, 22 Jul 2023 10:07:32 +0000 (19:07 +0900)]
Minor refactorings

15 months agoReland C++11 "shared_lock" with iter remove fix
Stephen Seo [Sat, 22 Jul 2023 09:58:36 +0000 (18:58 +0900)]
Reland C++11 "shared_lock" with iter remove fix

On iterator remove, the iterator will trade the read lock for a write
lock, and trade back for a read lock once the remove has been completed.

15 months agoAdd note in docs about update for UDPC_init(...)
Stephen Seo [Fri, 12 Jan 2024 04:31:36 +0000 (13:31 +0900)]
Add note in docs about update for UDPC_init(...)

15 months agoUpdate LICENSE year
Stephen Seo [Thu, 11 Jan 2024 12:05:21 +0000 (21:05 +0900)]
Update LICENSE year

15 months agoUpdate debug optimization flag
Stephen Seo [Thu, 11 Jan 2024 12:05:02 +0000 (21:05 +0900)]
Update debug optimization flag

15 months agoUnitTest for start/stop threaded update and fix
Stephen Seo [Thu, 11 Jan 2024 11:07:25 +0000 (20:07 +0900)]
UnitTest for start/stop threaded update and fix

15 months agoEnforce thread-safety on destroy context
Stephen Seo [Thu, 11 Jan 2024 10:40:15 +0000 (19:40 +0900)]
Enforce thread-safety on destroy context

15 months agoUse mutex when enabling/disabling threaded-update
Stephen Seo [Thu, 11 Jan 2024 10:00:27 +0000 (19:00 +0900)]
Use mutex when enabling/disabling threaded-update

15 months agoUse atomic_bool for auto-updating "flag"
Stephen Seo [Thu, 11 Jan 2024 09:42:06 +0000 (18:42 +0900)]
Use atomic_bool for auto-updating "flag"

15 months agoAdd note about usage of UDPC header in docs
Stephen Seo [Mon, 1 Jan 2024 08:15:55 +0000 (17:15 +0900)]
Add note about usage of UDPC header in docs

15 months agoNote in documentation about thread safety
Stephen Seo [Mon, 1 Jan 2024 03:25:04 +0000 (12:25 +0900)]
Note in documentation about thread safety

Basically, all functions should be thread-safe unless mentioned
otherwise.

16 months agoFixes to .forgejo/workflows/doxygen.yaml
Stephen Seo [Tue, 19 Dec 2023 07:44:02 +0000 (16:44 +0900)]
Fixes to .forgejo/workflows/doxygen.yaml

16 months agoUpdate README.md
Stephen Seo [Tue, 19 Dec 2023 03:59:10 +0000 (12:59 +0900)]
Update README.md

16 months agoUse rsync setting up seodisparate doxygen docs
Stephen Seo [Tue, 19 Dec 2023 03:54:52 +0000 (12:54 +0900)]
Use rsync setting up seodisparate doxygen docs

16 months agoAdd Forgejo workflow for doxygen docs
Stephen Seo [Tue, 19 Dec 2023 03:49:56 +0000 (12:49 +0900)]
Add Forgejo workflow for doxygen docs

21 months agoRevert "Impl "RWLock" for use in TSLQueue"
Stephen Seo [Sat, 22 Jul 2023 08:28:18 +0000 (17:28 +0900)]
Revert "Impl "RWLock" for use in TSLQueue"

This reverts commit cf27a6bb76f4dae2344d6061eb199e2b35eb754a.

The use of "shared_lock" in TSLQueue is unsafe because of two things:

  - The TSLQueue iterator takes a "read" lock.
  - The TSLQueue iterator can erase the current element.

21 months agoRevert "Replace unnecessary use of atomic in "shared_lock""
Stephen Seo [Sat, 22 Jul 2023 08:28:13 +0000 (17:28 +0900)]
Revert "Replace unnecessary use of atomic in "shared_lock""

This reverts commit b50e50b5fbdeaa3990984a6bda052bbb92c234a9.

21 months agoReplace unnecessary use of atomic in "shared_lock"
Stephen Seo [Sat, 22 Jul 2023 07:45:52 +0000 (16:45 +0900)]
Replace unnecessary use of atomic in "shared_lock"

21 months agoImpl "RWLock" for use in TSLQueue
Stephen Seo [Sat, 22 Jul 2023 07:29:19 +0000 (16:29 +0900)]
Impl "RWLock" for use in TSLQueue

This project supports C++11, and std::shared_lock was made available in
C++17, thus a "shared_spin_lock" was created with similar functionality.
This "shared_spin_lock" is used in TSLQueue.

21 months agoFix CMakeLists.txt, handle -Weffc++ warnings
Stephen Seo [Sat, 22 Jul 2023 04:25:43 +0000 (13:25 +0900)]
Fix CMakeLists.txt, handle -Weffc++ warnings

21 months agoUpdate README.md
Stephen Seo [Wed, 19 Jul 2023 02:35:28 +0000 (11:35 +0900)]
Update README.md

21 months agoAdd docs for UDPC_no* functions
Stephen Seo [Tue, 4 Jul 2023 02:41:45 +0000 (11:41 +0900)]
Add docs for UDPC_no* functions

21 months agoUpdate README.md
Stephen Seo [Mon, 3 Jul 2023 03:03:52 +0000 (12:03 +0900)]
Update README.md

21 months agoRefactor addr logprint via template specialization
Stephen Seo [Mon, 26 Jun 2023 05:01:42 +0000 (14:01 +0900)]
Refactor addr logprint via template specialization

22 months agoImpl "unsafe" versions of UDPC_atostr(...)
Stephen Seo [Thu, 22 Jun 2023 04:25:26 +0000 (13:25 +0900)]
Impl "unsafe" versions of UDPC_atostr(...)

These "unsafe" versions are guaranteed to not have the returned address
strings be overwritten by UDPC, but they must be manually free'd later
(as mentioned in the documentation).

22 months agoConditionally use UDPC_atostr internally
Stephen Seo [Thu, 22 Jun 2023 03:39:11 +0000 (12:39 +0900)]
Conditionally use UDPC_atostr internally

Previous implementation used UDPC_atostr() frequently. This commit
changes the implementation to only call UDPC_atostr() if the log level
of the code logging to output will cause the log to be output.

22 months agoAdd documentation for UDPC_atostr...
Stephen Seo [Thu, 22 Jun 2023 03:07:26 +0000 (12:07 +0900)]
Add documentation for UDPC_atostr...

22 months agoFix potential memory corruption bug
Stephen Seo [Wed, 21 Jun 2023 04:23:26 +0000 (13:23 +0900)]
Fix potential memory corruption bug

UDPC_atostr(...) uses a uint32_t as an offset into a buffer inside the
UDPC Context such that there can be at most 32 different addr-strings.
The call is thread-safe, up to a point (at most 32 concurrent calls will
return correct strings). The problem was that the offset was not being
reset to 0 and was always being incremented by 40. Should the offset
overflow, the offset into the buffer will be "mis-aligned" such that the
32nd offset into the buffer can possibly overwrite memory past the
buffer's end if the addr string is long enough.

The fix is to use a mutex instead of an atomic uint32_t to lock a
code-block that will always prevent overflow (using modulus operator).

I think the speed-loss is negligable (using a lock instead of an atomic
uint32_t) since it isn't expected for programs using UDPC to use
UDPC_atostr(...) very frequently.

2 years agoFix potential nullptr deref in free_PacketInfo_ptr
Stephen Seo [Wed, 19 Apr 2023 10:11:03 +0000 (19:11 +0900)]
Fix potential nullptr deref in free_PacketInfo_ptr

2 years agoAdd UDPC_free_PacketInfo_ptr(...)
Stephen Seo [Wed, 19 Apr 2023 09:26:45 +0000 (18:26 +0900)]
Add UDPC_free_PacketInfo_ptr(...)

Also add unit test for this function.

2 years agoUpdate LICENSE year
Stephen Seo [Tue, 18 Apr 2023 05:05:52 +0000 (14:05 +0900)]
Update LICENSE year

2 years agoRefactor UDPC::get_empty_pinfo()
Stephen Seo [Tue, 18 Apr 2023 05:03:31 +0000 (14:03 +0900)]
Refactor UDPC::get_empty_pinfo()

2 years agoImpl handling Ctrl-C for Windows in NetworkTest
Stephen Seo [Tue, 10 Jan 2023 03:14:57 +0000 (12:14 +0900)]
Impl handling Ctrl-C for Windows in NetworkTest

2 years agoBetter handling of receiving packets in recv loop
Stephen Seo [Tue, 10 Jan 2023 02:51:54 +0000 (11:51 +0900)]
Better handling of receiving packets in recv loop

On error processing a received packet, continue to receive packets in
the loop. If no packet was received, the loop ends.

2 years agoUpdate documentation about UDPC_update(ctx)
Stephen Seo [Thu, 8 Dec 2022 07:54:02 +0000 (16:54 +0900)]
Update documentation about UDPC_update(ctx)

2 years agoReceive packets in loop til none left in interval
Stephen Seo [Sun, 4 Dec 2022 10:57:37 +0000 (19:57 +0900)]
Receive packets in loop til none left in interval

Also some formatting fixes (max 80 chars in edited code).

2 years agoUpdate LICENSE
Stephen Seo [Wed, 23 Nov 2022 05:14:05 +0000 (14:14 +0900)]
Update LICENSE

2 years agoHandle SIGINT (Ctrl-C) in NetworkTest
Stephen Seo [Wed, 23 Nov 2022 05:13:44 +0000 (14:13 +0900)]
Handle SIGINT (Ctrl-C) in NetworkTest

3 years agoUpdate README.md
Stephen Seo [Thu, 9 Sep 2021 09:13:38 +0000 (18:13 +0900)]
Update README.md

3 years agoAdd gh-pages workflow for Doxygen documentation
Stephen Seo [Thu, 9 Sep 2021 09:10:07 +0000 (18:10 +0900)]
Add gh-pages workflow for Doxygen documentation

3 years agoUpdate .gitignore
Stephen Seo [Mon, 30 Aug 2021 03:07:27 +0000 (12:07 +0900)]
Update .gitignore

3 years agoFix README.md
Stephen Seo [Wed, 25 Aug 2021 10:45:01 +0000 (19:45 +0900)]
Fix README.md

4 years agoUpdate README.md
Stephen Seo [Sun, 14 Feb 2021 04:56:26 +0000 (13:56 +0900)]
Update README.md

4 years agoUpdate year in LICENSE
Stephen Seo [Sun, 10 Jan 2021 05:40:38 +0000 (14:40 +0900)]
Update year in LICENSE

4 years agoAdd |id| to PacketInfo
Stephen Seo [Sun, 10 Jan 2021 05:40:17 +0000 (14:40 +0900)]
Add |id| to PacketInfo

4 years agoUse dll_export (for builds for Windows)
Stephen Seo [Tue, 23 Jun 2020 04:01:27 +0000 (13:01 +0900)]
Use dll_export (for builds for Windows)

4 years agoAttempt to make NetworkTest work on Windows
Stephen Seo [Tue, 28 Apr 2020 11:55:16 +0000 (20:55 +0900)]
Attempt to make NetworkTest work on Windows

4 years agoAdd/fix more documentation
Stephen Seo [Tue, 28 Apr 2020 10:38:07 +0000 (19:38 +0900)]
Add/fix more documentation

4 years agoMinor fixes
Stephen Seo [Mon, 27 Apr 2020 10:34:04 +0000 (19:34 +0900)]
Minor fixes

4 years agoFix check addr endianness in a4toa6 function
Stephen Seo [Mon, 27 Apr 2020 02:47:50 +0000 (11:47 +0900)]
Fix check addr endianness in a4toa6 function

4 years agoImpl create id with hostname
Stephen Seo [Sun, 26 Apr 2020 09:36:49 +0000 (18:36 +0900)]
Impl create id with hostname

Previously, ids could only be created with an ip address. Now they can
be made with a hostname, which will be looked up by UDPC.

Also fix client still requesting connections even if
accept-new-connections flag is false.

5 years agoMinor fix to documentation
Stephen Seo [Sat, 18 Apr 2020 07:19:59 +0000 (16:19 +0900)]
Minor fix to documentation

5 years agoUse memcpy instead of pointer casted assignment
Stephen Seo [Sat, 18 Apr 2020 07:09:00 +0000 (16:09 +0900)]
Use memcpy instead of pointer casted assignment

std::memcpy is used over int pointer casted assignment due to possible
alignment issues that may cause the casted pointer to be invalid.

5 years agoChange how UDPC_PacketInfo handles it's data
Stephen Seo [Wed, 15 Apr 2020 10:49:17 +0000 (19:49 +0900)]
Change how UDPC_PacketInfo handles it's data

The "data" member variable in UDPC_PacketInfo is now handled as a
pointer to dynamic data, instead of an array with a fixed size. Every
time a UDPC_PacketInfo is received from the context,
UDPC_free_PacketInfo() must be called on it to avoid a memory leak.

5 years agoFix compilation fail on no libsodium
Stephen Seo [Fri, 6 Mar 2020 04:03:47 +0000 (13:03 +0900)]
Fix compilation fail on no libsodium

5 years agoFix use of C++14/C++17, only C++11 is supported
Stephen Seo [Fri, 6 Mar 2020 03:05:33 +0000 (12:05 +0900)]
Fix use of C++14/C++17, only C++11 is supported

5 years agoAdd helpers converting network-order (big-endian)
Stephen Seo [Thu, 16 Jan 2020 11:28:42 +0000 (20:28 +0900)]
Add helpers converting network-order (big-endian)

5 years agoFix UDPC::isBigEndian returning always true
Stephen Seo [Thu, 16 Jan 2020 11:28:01 +0000 (20:28 +0900)]
Fix UDPC::isBigEndian returning always true

5 years agoDistinguish manual variables and pkgconf variables
Stephen Seo [Thu, 16 Jan 2020 02:30:22 +0000 (11:30 +0900)]
Distinguish manual variables and pkgconf variables

Variables checked to manually set libsodium paths have been changed to
prevent conflict with variables set by searching for libsodium via
pkgconfig.

5 years agoAllow manually setting dependency libsodium paths
Stephen Seo [Thu, 16 Jan 2020 02:27:19 +0000 (11:27 +0900)]
Allow manually setting dependency libsodium paths

5 years agoFix verification message when using libsodium
Stephen Seo [Wed, 15 Jan 2020 07:31:38 +0000 (16:31 +0900)]
Fix verification message when using libsodium

Previous implementation had the client send only epoch-time-in-seconds
to be signed by the server. Now the client sends random data and
epoch-time to be signed by the server.

5 years agoUpdate README.md
Stephen Seo [Mon, 13 Jan 2020 10:26:05 +0000 (19:26 +0900)]
Update README.md

5 years agoFix doxygen documentation
Stephen Seo [Mon, 13 Jan 2020 10:22:08 +0000 (19:22 +0900)]
Fix doxygen documentation

5 years agoUpdate README.md
Stephen Seo [Mon, 13 Jan 2020 10:14:34 +0000 (19:14 +0900)]
Update README.md

5 years agoUpdate README.md
Stephen Seo [Mon, 13 Jan 2020 09:50:00 +0000 (18:50 +0900)]
Update README.md

5 years agoUpdate README.md
Stephen Seo [Mon, 13 Jan 2020 09:47:22 +0000 (18:47 +0900)]
Update README.md

5 years agoAdd LICENSE and README.md
Stephen Seo [Mon, 13 Jan 2020 09:40:14 +0000 (18:40 +0900)]
Add LICENSE and README.md

5 years agoSet pointers to const where possible in API
Stephen Seo [Fri, 10 Jan 2020 11:28:08 +0000 (20:28 +0900)]
Set pointers to const where possible in API

5 years agoTruncate "UDPConnection" to "UDPC"
Stephen Seo [Thu, 9 Jan 2020 07:57:01 +0000 (16:57 +0900)]
Truncate "UDPConnection" to "UDPC"

5 years agoFix potential non-null-terminated string bug
Stephen Seo [Thu, 9 Jan 2020 07:45:57 +0000 (16:45 +0900)]
Fix potential non-null-terminated string bug

5 years agoAdd more documentation, some fixes
Stephen Seo [Wed, 8 Jan 2020 11:50:56 +0000 (20:50 +0900)]
Add more documentation, some fixes

5 years agoReplace TSLQueue with std::deque where possible
Stephen Seo [Wed, 8 Jan 2020 10:55:12 +0000 (19:55 +0900)]
Replace TSLQueue with std::deque where possible

Also added std::mutex for each new std::deque. cSendPkts is left as a
TSLQueue because it needs to support fast removal from the middle of the
data structure (mainly because the queued packets per ConnectionData has
an imposed limit of packets to hold).

5 years agoMinor fix to keysSet atomic_bool
Stephen Seo [Sun, 5 Jan 2020 07:05:17 +0000 (16:05 +0900)]
Minor fix to keysSet atomic_bool

5 years agoMinor fixes
Stephen Seo [Sun, 5 Jan 2020 06:39:25 +0000 (15:39 +0900)]
Minor fixes

5 years agoFix usage of atomic_bool "keysSet"
Stephen Seo [Sun, 5 Jan 2020 06:31:37 +0000 (15:31 +0900)]
Fix usage of atomic_bool "keysSet"

5 years agoMinor refactoring/fix of use of atomic_bool
Stephen Seo [Sun, 5 Jan 2020 06:12:13 +0000 (15:12 +0900)]
Minor refactoring/fix of use of atomic_bool

5 years agoRefactor locking mutex during update
Stephen Seo [Sun, 5 Jan 2020 06:05:23 +0000 (15:05 +0900)]
Refactor locking mutex during update

5 years agoClient on connect fail now returns FAIL_CONNECT
Stephen Seo [Sun, 5 Jan 2020 05:49:37 +0000 (14:49 +0900)]
Client on connect fail now returns FAIL_CONNECT

Previously, returned event was DISCONNECT. FAIL_CONNECT is a new event
enum value.

5 years agoClient now regenerates verif-time on con attempt
Stephen Seo [Sun, 5 Jan 2020 05:42:57 +0000 (14:42 +0900)]
Client now regenerates verif-time on con attempt

5 years agoImplement publickey whitelist (using libsodium)
Stephen Seo [Thu, 2 Jan 2020 11:54:32 +0000 (20:54 +0900)]
Implement publickey whitelist (using libsodium)

Renamed "mutex" to "conMapMutex" since it is mainly used to lock access
to the connection map.

Removed UDPC_client_initiate_connection_pk() as publickey whitelisting
replaces its functionality.

5 years agoAdd verification of verification time server-side
Stephen Seo [Thu, 2 Jan 2020 07:33:17 +0000 (16:33 +0900)]
Add verification of verification time server-side

Verification string is no longer a string but seconds since epoch.

5 years agoChange: libsodium verification now on full packet
Stephen Seo [Thu, 2 Jan 2020 04:12:40 +0000 (13:12 +0900)]
Change: libsodium verification now on full packet

5 years agoFix copying over data of received packet
Stephen Seo [Mon, 30 Dec 2019 05:13:38 +0000 (14:13 +0900)]
Fix copying over data of received packet