Add keepalive advanced preference.
This commit is contained in:
parent
c9c831101a
commit
9b3fab1583
4 changed files with 26 additions and 13 deletions
|
@ -71,15 +71,6 @@
|
|||
default=yes
|
||||
[/advanced_preference]
|
||||
|
||||
#[advanced_preference]
|
||||
# field=dummy_slider
|
||||
# name="Dummy Slider"
|
||||
# type=int
|
||||
# default=42
|
||||
# min=0
|
||||
# max=50
|
||||
#[/advanced_preference]
|
||||
|
||||
[advanced_preference]
|
||||
field=chat_message_aging
|
||||
name= _ "Chat message aging"
|
||||
|
@ -160,5 +151,13 @@
|
|||
default=no
|
||||
[/advanced_preference]
|
||||
|
||||
#ifdef __UNUSED__
|
||||
#endif
|
||||
[advanced_preference]
|
||||
field=keepalive_timeout
|
||||
name= _ "Server disconnect timeout"
|
||||
description= _ "The amount of time in seconds before a disconnect is detected. If currently logged into the multiplayer server, you must log out and then log back in for this to take effect."
|
||||
type=int
|
||||
default=10
|
||||
min=10
|
||||
max=300
|
||||
step=5
|
||||
[/advanced_preference]
|
||||
|
|
|
@ -472,6 +472,16 @@ int font_scaled(int size)
|
|||
return (size * font_scaling()) / 100;
|
||||
}
|
||||
|
||||
int keepalive_timeout()
|
||||
{
|
||||
return prefs["keepalive_timeout"].to_int(10);
|
||||
}
|
||||
|
||||
void keepalive_timeout(int seconds)
|
||||
{
|
||||
prefs["keepalive_timeout"] = std::abs(seconds);
|
||||
}
|
||||
|
||||
bool idle_anim()
|
||||
{
|
||||
return get("idle_anim", true);
|
||||
|
|
|
@ -91,6 +91,9 @@ namespace preferences {
|
|||
void set_font_scaling(int scale);
|
||||
int font_scaled(int size);
|
||||
|
||||
int keepalive_timeout();
|
||||
void keepalive_timeout(int seconds);
|
||||
|
||||
bool idle_anim();
|
||||
void _set_idle_anim(const bool ison);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "gettext.hpp"
|
||||
#include "log.hpp"
|
||||
#include "preferences/general.hpp"
|
||||
#include "serialization/parser.hpp"
|
||||
#include "tls_root_store.hpp"
|
||||
|
||||
|
@ -161,12 +162,12 @@ void wesnothd_connection::handle_connect(const boost::system::error_code& ec, en
|
|||
}
|
||||
|
||||
// worker thread
|
||||
// TODO: have timeout set via advanced preferences
|
||||
void wesnothd_connection::handshake()
|
||||
{
|
||||
MPTEST_LOG;
|
||||
|
||||
set_keepalive(10);
|
||||
DBG_NW << "Connecting with keepalive of: " << preferences::keepalive_timeout();
|
||||
set_keepalive(preferences::keepalive_timeout());
|
||||
|
||||
static const uint32_t handshake = 0;
|
||||
static const uint32_t tls_handshake = htonl(uint32_t(1));
|
||||
|
|
Loading…
Add table
Reference in a new issue