25 #include <QLocalServer>
32 #include <QRecursiveMutex>
47 class async_readline_wrapper final :
public QThread {
50 async_readline_wrapper(
bool interactive, QObject *parent =
nullptr);
55 void wait_for_input();
58 void line_available(
const QString &line);
62 std::atomic<bool> m_stop;
105 void input_requested();
110 static QRecursiveMutex s_stdin_mutex;
111 static char **synchronized_completion(
const char *text,
int start,
~server() override
Shut down a server.
void accept_local_connections()
Server accepts connections over local socket: Low level socket stuff, and basic-initialize the connec...
void init_interactive()
Initializes interactive handling of stdin with libreadline.
void begin_phase()
Do everything needed to start a new phase on top of calling begin_phase.
bool prepare_game()
Prepares for a new game.
server()
Creates a server.
civtimer * m_between_turns_timer
void pulse()
Called every second.
void error_on_socket()
Called when there was an error on a socket.
void end_turn()
Do everything needed to end a turn on top of calling end_turn.
QObject * m_stdin_notifier
void input_on_socket()
Called when there's something to read on a socket.
bool shut_game_down()
Shuts a game down when all players have left.
bool m_need_send_pending_events
void input_on_stdin()
Called when there's something to read on stdin.
bool m_someone_ever_connected
void quit_idle()
Quit because we're idle (ie no one was connected in the last srvarg.quitidle seconds).
void update_game_state()
Checks if the game state has changed and take action if appropriate.
void end_phase()
Do everything needed to end a phase on top of calling end_phase.
void send_pings()
Sends pings to clients if needed.
void accept_tcp_connections()
Server accepts connections from client: Low level socket stuff, and basic-initialize the connection s...
void begin_turn()
Do everything needed to start a new turn on top of calling begin_turn.
bool is_ready() const
Checks if the server is ready for the event loop to start.
QTimer * m_quitidle_timer
std::variant< std::unique_ptr< QTcpServer >, std::unique_ptr< QLocalServer > > socket_server