62 Commits (66a53cde3db46185ac491439065d1c31bc53275f)

Author SHA1 Message Date
Adam Honse a7c400bc65 Update yet more file header comments to standardized new format 2 years ago
Adam Honse 89983dcdd1 Process received magic using a loop in client and server 2 years ago
Adam Honse cf4fd16b09 Define SDK magic string value as a shared constant in NetworkProtocol.cpp, use InitNetPacketHeader function to set up packets 2 years ago
Adam Honse 9215ae0514 Clean up comment formatting in NetworkServer.cpp 2 years ago
Adam Honse d7ed55b264 Use size when parsing received buffers into strings in NetworkServer 3 years ago
Jack e15b299684 SDK Plugins Fix 3 years ago
Jack 4baf19f13a SDK plugin control 3 years ago
B Horn a54f03e199 Fixing MacOS / Clang builds 4 years ago
B Horn 640eb7905c SDK Listening Options 4 years ago
Chris f3eac499d4 Allow for server side controller resizing
* Save sizes profile on the server
* Update RGBController_Network size on the client
4 years ago
Alex 4af8614fce Add formated loging for device detection
Commits merged and amended for code style by Adam Honse <calcprogrammer1@gmail.com>
5 years ago
Adam Honse 5130f07e21 Add saving support to network protocol 5 years ago
Chris a46eccef3c Added brightness to profile loading and saving
* Bumped profile version to 3
* Loading a v1/v2 profile onto a device with brightness will work
* Loading a v3 profile onto a device without brightness also works
* Add profile version parameter to Get/SetModeDescription

Commit amended for code style and to update versioning by Adam Honse <calcprogrammer1@gmail.com>
5 years ago
k1-801 65623d3978 Autoclose updated
Commit amended for code style by Adam Honse <calcprogrammer1@gmail.com>
5 years ago
k1-801 abfb6ea22d Tiny fixups (server conn info leak closed, log va leak closed, config dir optimized)
Commit amended for code style by Adam Honse <calcprogrammer1@gmail.com>
5 years ago
k1-801 02ba8a799e Server freed from ResourceManager
Commit amended to revert OpenRGBInterfaces.h header (may reconsider in the future) by Adam Honse
<calcprogrammer1@gmail.com>
5 years ago
Gabriel Marcano 30f88d5fcf Fix mismatched new[] / delete
- The device description buffer was allocated using new[] in
   RGBController. Make sure to free it using delete[].
5 years ago
morg 8ef9f622f1 Fix memory leak (RGBController::GetDeviceDescription) 5 years ago
morg 79dacbaeb0 Fix crash on server stop
Commit amended to initialize listening variable by Adam Honse <calcprogrammer1@gmail.com>
5 years ago
morg e2bc1003e6 Add profile management to SDK
Commit amended for code style by Adam Honse <calcprogrammer1@gmail.com>
5 years ago
Adam Honse 72da8f362c SDK protocol versioning implemented. Protocol updated to version 1 which adds vendor string to controller request. 6 years ago
k1-801 dde857dfb4 Tiny threads fixes & a little bit of safety 6 years ago
Adam Honse c3b4489fd3 Fix Windows build 6 years ago
Adam Honse 60fd721586 Server sends a request to the client when the device list is updated 6 years ago
Adam Honse f568253c51 Clean up more warnings 6 years ago
k1-801 8b8451017e Non-important warnings removed
Commit amended by Adam Honse <calcprogrammer1@gmail.com> due to merging from a different branch.
6 years ago
B Horn f02223d6ba Checks to avoid null dereferences in NetworkServer
Various commands in NetworkServer require extra data. However, if the
packet size is set to 0 for these, the code will skip over reading the
data in and allocating memory. This results in null dereferences.

This patch adds checks to the relevant commands to make sure they don't
continue reading a null pointer.
6 years ago
Adam Honse 0ccf2d0c33 Remove some debugging printouts in Network Client and Server code 6 years ago
B Horn 47baeb6b6b Improving NetworkServer's memory management (#373)
This patch resolves several bugs:

* NetworkServer would allocate various instances of `NetworkClientInfo`.
  This is patched by deallocating the NetworkClientInfo when it's
  listening thread ends in the `listen_done` section.

* Memory would be allocated for threads that wouldn't be freed. This
  is resolved by detaching from the threads, so they no longer need to
  be joined to be freed, and then freeing the memory as they finish.

* Thread-Safety issues involving `ServerClients` would result in stray
  `NetworkClientInfo`'s not being removed from the list in certain
  situations. This is resolved by used a mutex to lock access to this
  from different threads.
6 years ago
Adam Honse 96af869d79 Check for local server before detecting devices from hardware and tweak timeouts to make network connections faster 6 years ago
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
6 years ago
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.
6 years ago
Térence Clastres b79ff124e6 Replace Sleep() by std:🧵:sleep_for() 6 years ago
Adam Honse 0464fbcbe2 Make default SDK port a defined constant 6 years ago
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)
6 years ago
Adam Honse e6aadc414b Handle socket errors on Windows, which does not return 0 when a socket is disconnected like Linux does 6 years ago
Matt Harper 69e1e19bf9 Bugfix - properly free ServerClients 6 years ago
Adam Honse 352b9928ca Add file headers to network files and some minor code cleanup 6 years ago
Adam Honse 6438c15dd3 Fix build on Windows 6 years ago
Adam Honse a5e9a3de05 Add mutex on updating callbacks 6 years ago
Adam Honse edf1b251c0 Send and receive client string 6 years ago
Adam Honse 9ff4314840 Add callback to NetworkServer to handle UI updates when client information changes 6 years ago
Adam Honse 3ad0986ae7 Add IP field to client information and display client IP in the server tab's connected client list 6 years ago
Adam Honse 6bfc9dd9db Create a structure to hold client information in the network server and fix i2c hanging on destructor when bus is not available. 6 years ago
Adam Honse 119741b736 Fix build on Windows 6 years ago
Adam Honse 2fe958783c Use select on accept call as well so that server closes on Linux 6 years ago
Adam Honse 9e44e4ba4f Add server information to user interface and provide buttons to start and stop server, change port 6 years ago
Adam Honse 81acc47cd6 Use std::thread for NetworkServer threads 6 years ago
Adam Honse 25f7a87a79 Get network server working in Windows 6 years ago
Adam Honse 4d6706ce61 Close server listener thread when read returns zero (client connection lost) 6 years ago