Commit Graph

40 Commits (528d7b1be146f04d6f2c414e6b932967e3a73e76)

Author SHA1 Message Date
Myk Taylor ba872902c8
Merge remote-tracking branch 'cvuchener/server-accept-fix' into myk_remote_server 2023-11-20 00:07:00 -08:00
Clément Vuchener 77ce84ca0a Improve Accept error handling in RemoteServer
Also makes sure the socket is blocking to avoid EWOULDBLOCK errors.
2023-11-19 14:46:14 +01:00
Kelly Kinkade 29ca6bbd34 RemoteServer: reset fail counter after success
should close #4040
2023-11-19 06:59:04 -06:00
Myk fa78bde481
Update library/RemoteServer.cpp
Co-authored-by: Alan <lethosor@users.noreply.github.com>
2023-11-06 17:31:46 -08:00
Myk c6db01a3a2
Update library/RemoteServer.cpp 2023-11-06 17:31:41 -08:00
Kent Gustavsson 09148698c8 add counter for socket accept fails
Signed-off-by: Kent Gustavsson <kent@minoris.se>
2023-06-26 22:47:21 +02:00
Kent Gustavsson ccae8bc77b add error output on failing to accept connection
Signed-off-by: Kent Gustavsson <kent@minoris.se>
2023-06-26 22:47:21 +02:00
Kent Gustavsson dfd453ae05 fix so failed accept doesn't terminate the server
Signed-off-by: Kent Gustavsson <kent@minoris.se>
2023-06-26 22:47:21 +02:00
Myk Taylor f05fe33307
fix crash on malformed json (again) 2023-05-16 11:26:47 -07:00
myk002 dec6d3d379
Revert "update google protobuf to 3.21.10"
This reverts commit 9dabf51ac7.
2022-12-07 11:59:48 -08:00
myk002 9dabf51ac7
update google protobuf to 3.21.10 2022-12-07 11:59:15 -08:00
myk002 5b9c18fc3c
migrate string fns from uicommon to MiscUtils
and clean up some leaky usings
2022-11-07 15:36:16 -08:00
Ben Lubar 3c9f6f79ab
fix some warnings 2020-02-10 19:35:17 -06:00
Pauli 49f3de979f Make ServerMain and ServerConnection data race free
RemoteServer and PluginManager side would need complete redesign to be
data race free and concurrent. But as that would be unlikely to be
required from DFHack I decided simpler solution that is fixing data
ownership to a thread and all ServerConnection share a single lock which
allows access to PluginManager and Core.
2019-07-18 23:05:11 -04:00
Ben Lubar 3b6a0738a0
Add check-rpc.py for Travis. 2018-07-04 15:32:06 -05:00
lethosor c543a17250 Improve RPC port handling
- Use port from remote-server.json in dfhack-run
- Make DFHACK_RUN environment variable take priority over remote-server.json
- Log current port to stderr
2018-07-02 23:53:56 -04:00
Pauli 2b79b4cce7 Use jsoncpp 1.8.4 as a submodule
This makes jsoncpp a submodule that can be build directly from git
sources. This changes depends/jsoncpp to depends/jsoncpp-sub to avoid
filename conflict if someone tries to use git bisect.

jsoncpp library name changes to jsoncpp_lib_static.

jsoncpp version is the latest tagged release.
2018-06-14 21:20:46 +03:00
Japa 74bf06c69e Do some checks before trying to read json files. 2018-02-13 20:02:42 +05:30
Japa Mala Illo 69a88e1641 Use json for server config. 2017-11-25 11:34:02 +05:30
Japa Mala Illo 272f51ef4b Merge remote-tracking branch 'remotes/DFHack/master' into RemoteServerUnsafe 2017-11-25 10:24:51 +05:30
Ben Lubar d3f3ebf778
auto_ptr is deprecated - use unique_ptr instead 2017-10-04 14:49:28 -05:00
Japa Illo 3c5483df03 Change tabs to spaces to satisfy travis. 2017-10-04 09:48:12 +05:30
Japa bb1eb0b48a Use a config file to enable outside connections. 2017-10-03 19:48:37 +05:30
Japa cbeb241435 Listen on any address 2017-10-02 20:48:05 +05:30
Japa 8dffd48f70 Add a flag for functions considered safe for a remote computer to call. 2017-10-02 19:55:16 +05:30
lethosor f07bc03c69 Update clsocket and Open()/Listen() usage 2016-06-14 13:21:51 -04:00
Ben Lubar 700392ba55 Fix tinythread memory leak in two ways:
1. update to tinythread version 1.1, which provides a detach method
2. move the thread disassociation to the join function, which allows
attached threads to be joined even after they finish (this was the main
leak)

Also update RemoteServer.cpp to detach threads and delete the thread
objects instead of leaking them (although they are much smaller than the
actual threads).
2016-05-21 19:17:08 -05:00
Timothy Collett 274d6038ad Merge further changes (???) 2012-09-10 09:19:21 -04:00
Alexander Gavrilov 9469f27559 Make the RPC server accept a range of client versions.
Otherwise it sort of defeats the purpose of using version handshake.
2012-06-14 13:15:37 +04:00
Alexander Gavrilov b9ecd03fe2 Make the server suspend the core around calls unless disabled.
I expect the majority of methods will have to suspend the core
first thing anyway, so this will reduce typing and bugs.

Also get rid of the "me->" ugliness by splitting threadFn.
2012-03-18 11:04:15 +04:00
Alexander Gavrilov aa63493bb8 Add a ListSquads request. 2012-03-17 20:04:15 +04:00
Alexander Gavrilov 368b92f81f Add a RPC call to retrieve unit info.
For performance reasons, material flag arrays are changed to use ints,
with enum item name mappings retrievable via a different RPC call.
2012-03-17 17:41:56 +04:00
Alexander Gavrilov 15ccfbb086 Add a ListMaterials remote call for bulk download of basic material info. 2012-03-17 15:36:42 +04:00
Alexander Gavrilov 14d6a62e1d Move CoreService to a separate file. 2012-03-17 12:09:30 +04:00
Petr Mrázek c72fb76316 MSVC fixage for the new socket API 2012-03-15 22:05:33 +01:00
Alexander Gavrilov 4eb4811777 Make the DF suspend lock recursive, and add RPC calls for batch suspend.
The idea is that if you have to execute many RPC calls, it is
faster to suspend once. The service class takes care to auto-resume
in the destructor in case the client just disappears.
2012-03-15 15:33:19 +04:00
Alexander Gavrilov 605ee9669a Plugin-exported functions now actually work. 2012-03-15 14:06:50 +04:00
Alexander Gavrilov 87f925e72e Add support for exporting functions from plugins, with example in rename.
TODO: test by actually calling them remotely.
2012-03-15 13:01:23 +04:00
Alexander Gavrilov e7851f5abd Improve support for void RPC functions, dfhack-run, etc. 2012-03-15 11:07:43 +04:00
Alexander Gavrilov 560e977f05 Implement trivial RPC interface for dfhack via TCP & protobufs.
Use it to make an executable capable of calling commands remotely.
2012-03-14 19:57:29 +04:00