mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
network: ping pong keepalive for tcp connections
To make the tcp connections keepalive and better handle the timeout of connections con_timeout indicate the connection timeout and it is configurable Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
This commit is contained in:
parent
eba03547a5
commit
47e98efed6
8 changed files with 136 additions and 30 deletions
|
|
@ -109,7 +109,7 @@ struct time_config_s {
|
|||
time_t update_tcp_con; // Refresh network connections
|
||||
time_t update_chan_util; // Refresh per radio / SSID channel util info
|
||||
time_t update_beacon_reports; // Request BEACON from capable clients
|
||||
time_t client_timeout; // Check for client timeouts.
|
||||
time_t con_timeout; // Check for connection timeouts.
|
||||
};
|
||||
|
||||
struct local_config_s {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <netinet/in.h>
|
||||
|
||||
#define ARRAY_NETWORK_LEN 50
|
||||
#define CHECK_CLIENT_TIMEOUT 5
|
||||
#define CHECK_TIMEOUT 10
|
||||
|
||||
struct network_con_s {
|
||||
struct list_head list;
|
||||
|
|
@ -14,6 +14,7 @@ struct network_con_s {
|
|||
struct ustream_fd stream;
|
||||
struct sockaddr_in sock_addr;
|
||||
int connected;
|
||||
time_t time_alive;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -38,9 +39,14 @@ int run_server(int port);
|
|||
void send_tcp(char *msg);
|
||||
|
||||
/**
|
||||
* Check sockets for client timeouts.
|
||||
* Send ping to clients
|
||||
*/
|
||||
void check_client_timeout(int timeout);
|
||||
void server_to_clients_ping(void);
|
||||
|
||||
/**
|
||||
* Check sockets timeouts.
|
||||
*/
|
||||
void check_timeout(int timeout);
|
||||
|
||||
/**
|
||||
* Debug message.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue