Freeciv-3.3
|
#include "fc_prehdrs.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "capability.h"
#include "fciconv.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "netintf.h"
#include "shared.h"
#include "support.h"
#include "timing.h"
#include "dataio.h"
#include "events.h"
#include "game.h"
#include "packets.h"
#include "script_server.h"
#include "aiiface.h"
#include "auth.h"
#include "connecthand.h"
#include "console.h"
#include "meta.h"
#include "plrhand.h"
#include "srv_main.h"
#include "stdinhand.h"
#include "voting.h"
#include "sernet.h"
Go to the source code of this file.
Data Structures | |
struct | packet_to_handle |
Macros | |
#define | PROCESSING_TIME_STATISTICS 0 |
Variables | |
static struct connection | connections [MAX_NUM_CONNECTIONS] |
static int * | listen_socks |
static int | listen_count |
static int | socklan |
static bool | no_input = FALSE |
static char * | current_internal = NULL |
|
static |
Close the connection (very low-level). See also server_conn_close_callback().
Definition at line 223 of file sernet.c.
Referenced by close_connections_and_socket(), and really_close_connections().
Close all network stuff: connections, listening sockets, metaserver connection...
Definition at line 255 of file sernet.c.
Referenced by server_quit().
|
static |
Ping a connection.
Definition at line 1427 of file sernet.c.
Referenced by server_sniff_all_input().
|
static |
If a connection lags too much this function is called and we try to cut it.
Definition at line 351 of file sernet.c.
Referenced by flush_packets(), and server_sniff_all_input().
|
static |
Finish processing of request packet from client.
Definition at line 1409 of file sernet.c.
Referenced by incoming_client_packets().
Attempt to flush all information in the send buffers for upto 'netwait' seconds.
Definition at line 376 of file sernet.c.
Referenced by begin_phase(), dai_do_first_activities(), end_phase(), send_all_known_cities(), send_all_known_tiles(), and send_all_known_units().
Listen for UDP packets multicasted from clients requesting announcement of servers on the LAN.
Definition at line 1493 of file sernet.c.
Referenced by server_sniff_all_input().
|
static |
Simplify a loop by wrapping get_packet_from_connection.
Definition at line 451 of file sernet.c.
Referenced by incoming_client_packets().
void handle_client_heartbeat | ( | struct connection * | pconn | ) |
Handle client's regular hearbeat
Definition at line 1461 of file sernet.c.
Referenced by server_handle_packet().
void handle_conn_pong | ( | struct connection * | pconn | ) |
Handle response to ping.
Definition at line 1441 of file sernet.c.
Referenced by server_handle_packet(), and server_packet_input().
This happens if you type an EOF character with nothing on the current line.
Definition at line 139 of file sernet.c.
Referenced by server_sniff_all_input().
|
static |
Handle all incoming packets on a client connection. Precondition - we have read_socket_data. Postcondition - there are no more packets to handle on this connection.
Definition at line 464 of file sernet.c.
Referenced by server_sniff_all_input().
Initialize connection related stuff. Attention: Logging is not available within this functions!
Definition at line 1362 of file sernet.c.
Referenced by main(), and srv_prepare().
Make up a name for the connection, before we get any data from it to use as a sensible name. Name will be 'c' + integer, guaranteed not to be the same as any other connection name, nor player name nor user name, nor connection id (avoid possible confusions). Returns pointer to static buffer, and fills in (*id) with chosen value.
Definition at line 959 of file sernet.c.
Referenced by server_make_connection().
Clear readline stuff at exit. To cater for as many different cases as possible, we call this both like any function call from server_quit() before exit(), and as a atexit handler. Former is to get everything cleared already before exit(), before any other atexit handler comes to play. Latter is to make sure that the function gets called also when in those rare cases where we exit some other way than server_quit() - that's important for always restoring terminal to a working state.
That means that in usual case this function gets called twice. Make sure that it doesn't try double frees or similar when that happens.
Definition at line 204 of file sernet.c.
Referenced by server_quit(), and server_sniff_all_input().
Now really close connections marked as 'is_closing'. Do this here to avoid recursive sending.
Definition at line 304 of file sernet.c.
Referenced by server_sniff_all_input().
This function broadcasts an UDP packet to clients with that requests information about the server state.
Definition at line 1542 of file sernet.c.
Referenced by get_lanserver_announcement().
Send ping time info about all connections to all connections.
Definition at line 1469 of file sernet.c.
Referenced by server_sniff_all_input().
Server accepts connection from client: Low level socket stuff, and basic-initialize the connection struct. Returns 0 on success, -1 on failure (bad accept(), or too many connections).
Definition at line 986 of file sernet.c.
Referenced by server_sniff_all_input().
|
static |
Break a client connection. You should almost always use connection_close_server() instead of calling this function directly.
Definition at line 342 of file sernet.c.
Referenced by server_open_socket().
Server accepts connection from client: Low level socket stuff, and basic-initialize the connection struct. Returns 0 on success, -1 on failure (bad accept(), or too many connections).
Definition at line 1071 of file sernet.c.
Referenced by server_accept_connection().
Open server socket to be used to accept client connections and open a server socket for server LAN announcements.
Definition at line 1133 of file sernet.c.
Referenced by srv_prepare().
enum server_events server_sniff_all_input | ( | void | ) |
Get and handle:
This function also handles prompt printing, via the con_prompt_* functions. That is, other functions should not need to do so. –dwp
Definition at line 522 of file sernet.c.
Referenced by srv_main(), and srv_running().
|
static |
Starts processing of request packet from client.
Definition at line 1394 of file sernet.c.
Referenced by incoming_client_packets().
|
static |
Definition at line 94 of file sernet.c.
Referenced by clear_worker_task(), client_handle_packet(), close_connections_and_socket(), flush_packets(), handle_conn_ping_info(), init_connections(), package_and_send_worker_tasks(), really_close_connections(), receive_packet_conn_ping_info_100(), server_make_connection(), and server_sniff_all_input().
Definition at line 152 of file sernet.c.
Referenced by readline_atexit(), and server_sniff_all_input().
|
static |
Definition at line 97 of file sernet.c.
Referenced by close_connections_and_socket(), server_open_socket(), and server_sniff_all_input().
|
static |
Definition at line 96 of file sernet.c.
Referenced by close_connections_and_socket(), server_open_socket(), and server_sniff_all_input().
Definition at line 130 of file sernet.c.
Referenced by handle_stdin_close(), and server_sniff_all_input().
|
static |
Definition at line 98 of file sernet.c.
Referenced by close_connections_and_socket(), get_lanserver_announcement(), and server_open_socket().