tools: Some subtitle editor cleanup and add hint support (#1450)

* nrepl: detect a disconnected client better

* tools: remove some duplicate code

* tools: add hint playing support

* lint: formatting
This commit is contained in:
Tyler Wilding
2022-06-12 21:07:03 -04:00
committed by GitHub
parent b053da7e33
commit ad959e6291
5 changed files with 283 additions and 256 deletions
+7 -1
View File
@@ -34,7 +34,13 @@ void ReplServer::post_init() {
void ReplServer::ping_response(int socket) {
std::string ping = fmt::format("Connected to OpenGOAL v{}.{} nREPL!",
versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR);
write_to_socket(socket, ping.c_str(), ping.size());
auto resp = write_to_socket(socket, ping.c_str(), ping.size());
if (resp == -1) {
fmt::print("[nREPL:{}] Client Disconnected: {}\n", tcp_port, inet_ntoa(addr.sin_addr),
ntohs(addr.sin_port), socket);
close_socket(socket);
client_sockets.erase(socket);
}
}
std::optional<std::string> ReplServer::get_msg() {