64 Commits

Author SHA1 Message Date
Adam Honse
c71cc4f18a Change SPDX license identifier from GPL 2.0 only to GPL 2.0 or later, as the original LICENSE file includes an or later clause at the end so the file headers were incorrect 2025-09-28 00:47:08 -05:00
Adam Honse
2affb6d1e7 Add missing send_in_progress locks around send groups in NetworkClient.cpp 2025-07-04 23:32:16 -05:00
Adam Honse
4cc6a28e73 Rework NetworkClient server initialization to allow interruption and restarting of server list request process when server sends a device list updated notification 2025-07-04 04:24:37 -05:00
Adam Honse
5aaadf4e5a Require protocol version 5 to send rescan devices packet and to show rescan button in clients list 2025-07-04 04:24:37 -05:00
Adam Honse
80dee91ab9 Add client functionality to send rescan request and add rescan button for each client in client list 2025-07-04 04:24:37 -05:00
Adam Honse
bb79fbfc07 Add controller flags field with flags for controller location and update behavior 2025-02-06 20:00:27 -06:00
Adam Honse
012cb5e62d Fix segment creation and modification over the network protocol 2025-02-06 20:00:27 -06:00
Adam Honse
9d3956c168 Fix warnings in NetworkClient.cpp 2024-11-26 00:37:30 -06:00
Adam Honse
8a36717842 Remove LogManager dependency from NetworkClient.cpp
NetworkClient/Server code should have minimal internal dependencies as it is intended to be includable in external applications, pulling in only the absolutely necessary files so that it may be used in third party SDK applications.  LogManager is not a necessary dependency.
2024-09-27 11:25:55 -05:00
Dmitry Kychanov
d612b8b8de Network shutdown optimization 2024-09-27 16:15:14 +00:00
Adam Honse
e2126b9d29 Fix resizing zones over the network 2024-07-27 17:56:12 -05:00
Adam Honse
99c1aa0c26 Add a mutex around groups of send() calls in NetworkClient.cpp to fix corrupt packets due to race conditions. If two network RGBControllers try to send a packet with data at the same time, a race condition could cause data from another thread to send in between the header and data for the active thread, corrupting the data stream. 2024-07-27 16:23:54 -05:00
Adam Honse
44268596b3 Add a size check to the client on controller data receiving 2024-07-26 00:39:45 -05:00
Adam Honse
a7c400bc65 Update yet more file header comments to standardized new format 2024-05-03 21:56:32 -05:00
Adam Honse
89983dcdd1 Process received magic using a loop in client and server 2024-03-25 19:56:33 -05:00
Adam Honse
cf4fd16b09 Define SDK magic string value as a shared constant in NetworkProtocol.cpp, use InitNetPacketHeader function to set up packets 2024-03-25 19:45:06 -05:00
Adam Honse
1c62c26cac Clean up comment formatting in NetworkClient.cpp 2024-03-24 19:35:59 -05:00
Adam Honse
219483267c Fix MacOS warning in NetworkClient.cpp 2022-09-14 23:14:55 -05:00
B Horn
640eb7905c SDK Listening Options 2022-07-17 20:30:15 +00:00
Chris
f3eac499d4 Allow for server side controller resizing
* Save sizes profile on the server
* Update RGBController_Network size on the client
2022-07-04 20:16:39 +00:00
B Horn
937451d6e8 SDK Client Disconnection Fixes 2022-06-12 04:43:15 +00:00
Adam Honse
b6cc0bda21 Fix profile packets in SDK client not including the null terminator for the strings 2021-09-19 22:44:34 -05:00
Adam Honse
5130f07e21 Add saving support to network protocol 2021-07-04 21:17:55 -05:00
Adam Honse
d88f9979a9 Rework network client callback pipeline - route callbacks from clients through ResourceManager so that device list callbacks get called. Fixes remote devices not showing up in plugins. 2021-05-14 23:29:34 -05:00
k1-801
402423e338 Fix a memory leak in NetworkClient 2021-04-25 16:55:15 -05:00
morg
e2bc1003e6 Add profile management to SDK
Commit amended for code style by Adam Honse <calcprogrammer1@gmail.com>
2021-02-05 19:13:50 -06:00
Adam Honse
72da8f362c SDK protocol versioning implemented. Protocol updated to version 1 which adds vendor string to controller request. 2020-12-01 21:02:32 -06:00
k1-801
dde857dfb4 Tiny threads fixes & a little bit of safety 2020-11-15 13:28:29 -06:00
Adam Honse
716b2aaac3 Protect controller list updates with mutex 2020-09-30 22:45:03 -05:00
Adam Honse
8347644b07 Client clears list and reinitializes controller when the device list updates 2020-09-28 01:29:35 +00:00
Adam Honse
f568253c51 Clean up more warnings 2020-09-02 18:25:58 -05:00
k1-801
8b8451017e Non-important warnings removed
Commit amended by Adam Honse <calcprogrammer1@gmail.com> due to merging from a different branch.
2020-09-01 23:29:00 -05:00
Térence Clastres
53379c5482 Fixes for memory issues detected by valgrind 2020-08-12 23:48:03 -05:00
Adam Honse
0ccf2d0c33 Remove some debugging printouts in Network Client and Server code 2020-07-17 22:10:53 -05:00
Adam Honse
5ce6ec9ea7 Request updated controller mode from server after sending a Set Custom Mode command 2020-07-17 18:29:37 -05:00
Neel Chotai
263561868c fix musl compilation 2020-07-09 21:51:33 -05:00
Adam Honse
96af869d79 Check for local server before detecting devices from hardware and tweak timeouts to make network connections faster 2020-06-28 21:08:59 -05:00
Térence Clastres
1db412e970 Fix high CPU usage when running the SDK server
It was coming from `recv_select()` and `accept_select()`
The timeval struct members for select() is reset after each call to select() for
whatever reason so like FD_ZERO and FD_SET it needs to be placed inside
the loop.

Source: https://stackoverflow.com/questions/3324078/why-select-always-return-0-after-the-first-timeout
2020-06-24 10:08:40 -05:00
Térence Clastres
b94f701db8 Fix high CPU usage when running the SDK server
It was coming from `recv_select()` `nd accept_select()`
The timeout for select() is only when waiting for the file descriptor to
be ready for reading/writing so when the FD is ready AND there is
nothing to read, it will not return and instead keep executing the while loop with no timeout.
Fix this by adding a 100ms timeout when there is nothing to read.
2020-06-24 09:35:31 -05:00
Térence Clastres
b79ff124e6 Replace Sleep() by std::thread::sleep_for() 2020-06-24 09:28:11 -05:00
Adam Honse
0464fbcbe2 Make default SDK port a defined constant 2020-06-22 11:32:32 -05:00
Térence Clastres
6d585d3eeb Network: Print used port on startup and change default to 6742
Also print an error if server can't be started

1337 is already used by razer's rest server
Port idea by @bahorn (6742 = ORGB on a phone numpad)
2020-06-20 14:39:14 -05:00
Adam Honse
f2c1022c7f Don't consider client online until it has been initialized 2020-06-15 22:41:33 -05:00
Adam Honse
cbb13b0d22 Add MacOS support to NetworkClient.cpp 2020-05-16 23:33:49 -07:00
Adam Honse
bd6ec4c41e Get client stop function working 2020-05-14 10:06:22 -05:00
Adam Honse
e6aadc414b Handle socket errors on Windows, which does not return 0 when a socket is disconnected like Linux does 2020-05-10 16:22:29 -05:00
Adam Honse
883a78ad9d Fix client on Windows 2020-05-10 16:16:59 -05:00
Adam Honse
15d23d3009 Add client status update callback to NetworkClient 2020-05-10 13:41:01 -05:00
Adam Honse
e2c2b8c1df Client will now close listener thread when disconnected and attempt to reconnect. Initialization behavior (controller requests, client string update) are performed automatically upon reconnection 2020-05-10 01:19:38 -05:00
Adam Honse
352b9928ca Add file headers to network files and some minor code cleanup 2020-05-09 15:48:16 -05:00