mirror of
https://github.com/open-goal/jak-project
synced 2026-08-22 07:04:29 -04:00
goalc: Add TCP server socket in REPL process (#1335)
* goalc: cleanup goalc's main method and add nrepl listener socket * deps: add standalone ASIO for sockets * lint: formatting * common: make a common interface for creating a server socket * goalc: setup new repl server * deps: remove asio * goalc: debug issues, nrepl is working again * git: rename files * attempt to fix linux function call * test * scripts: make the error message even more obvious.... * goalc: make suggested changes, still can't reconnect properly * game: pull out single-client logic from XSocketServer * nrepl: supports multiple clients and disconnection/reconnects * goalc: some minor fixes for tests * goalc: save repl history when the compiler reloads * common: add include for linux networking * a few small changes to fix tests * is it the assert? * change thread start order and add a print to an assert Co-authored-by: water <awaterford111445@gmail.com>
This commit is contained in:
+8
-8
@@ -9,6 +9,8 @@
|
||||
#elif _WIN32
|
||||
#include <io.h>
|
||||
#include "third-party/mman/mman.h"
|
||||
#define NOMINMAX
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
@@ -74,7 +76,7 @@ void deci2_runner(SystemThreadInterface& iface) {
|
||||
std::function<bool()> shutdown_callback = [&]() { return iface.get_want_exit(); };
|
||||
|
||||
// create and register server
|
||||
Deci2Server server(shutdown_callback);
|
||||
Deci2Server server(shutdown_callback, DECI2_PORT);
|
||||
ee::LIBRARY_sceDeci2_register(&server);
|
||||
|
||||
// now its ok to continue with initialization
|
||||
@@ -84,20 +86,20 @@ void deci2_runner(SystemThreadInterface& iface) {
|
||||
lg::debug("[DECI2] Waiting for EE to register protos");
|
||||
server.wait_for_protos_ready();
|
||||
// then allow the server to accept connections
|
||||
if (!server.init()) {
|
||||
ASSERT(false);
|
||||
if (!server.init_server()) {
|
||||
ASSERT_MSG(false, "[DECI2] Server not initialized even if protocols are ready, aborting");
|
||||
}
|
||||
|
||||
lg::debug("[DECI2] Waiting for listener...");
|
||||
bool saw_listener = false;
|
||||
while (!iface.get_want_exit()) {
|
||||
if (server.check_for_listener()) {
|
||||
if (server.is_client_connected()) {
|
||||
if (!saw_listener) {
|
||||
lg::debug("[DECI2] Connected!");
|
||||
}
|
||||
saw_listener = true;
|
||||
// we have a listener, run!
|
||||
server.run();
|
||||
server.read_data();
|
||||
} else {
|
||||
// no connection yet. Do a sleep so we don't spam checking the listener.
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(50000));
|
||||
@@ -314,10 +316,8 @@ RuntimeExitStatus exec_runtime(int argc, char** argv) {
|
||||
|
||||
// step 3: start the EE!
|
||||
iop_thread.start(iop_runner);
|
||||
ee_thread.start(ee_runner);
|
||||
|
||||
deci_thread.start(deci2_runner);
|
||||
|
||||
ee_thread.start(ee_runner);
|
||||
if (VM::use) {
|
||||
vm_dmac_thread.start(dmac_runner);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user