Freeciv-3.2
|
#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 228 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 260 of file sernet.c.
Referenced by server_quit().
|
static |
Ping a connection.
Definition at line 1431 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 356 of file sernet.c.
Referenced by flush_packets(), and server_sniff_all_input().
|
static |
Finish processing of request packet from client.
Definition at line 1413 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 381 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 1497 of file sernet.c.
Referenced by server_sniff_all_input().
|
static |
Simplify a loop by wrapping get_packet_from_connection.
Definition at line 456 of file sernet.c.
Referenced by incoming_client_packets().
void handle_client_heartbeat | ( | struct connection * | pconn | ) |
Handle client's regular hearbeat
Definition at line 1465 of file sernet.c.
Referenced by server_handle_packet().
void handle_conn_pong | ( | struct connection * | pconn | ) |
Handle response to ping.
Definition at line 1445 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 144 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 469 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 1366 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 963 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 209 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 309 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 1546 of file sernet.c.
Referenced by get_lanserver_announcement().
Send ping time info about all connections to all connections.
Definition at line 1473 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 990 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 347 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 1075 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 1137 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 527 of file sernet.c.
Referenced by srv_main(), and srv_running().
|
static |
Starts processing of request packet from client.
Definition at line 1398 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 157 of file sernet.c.
Referenced by readline_atexit(), and server_sniff_all_input().
|
static |
Definition at line 101 of file sernet.c.
Referenced by close_connections_and_socket(), server_open_socket(), and server_sniff_all_input().
|
static |
Definition at line 100 of file sernet.c.
Referenced by close_connections_and_socket(), server_open_socket(), and server_sniff_all_input().
Definition at line 135 of file sernet.c.
Referenced by handle_stdin_close(), and server_sniff_all_input().
|
static |
Definition at line 102 of file sernet.c.
Referenced by close_connections_and_socket(), get_lanserver_announcement(), and server_open_socket().