mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 20:06:49 +01:00
Added start_on_ready property to WebServerSimple.
This commit is contained in:
parent
d9512f8d40
commit
8f352b745a
@ -51,6 +51,13 @@ void WebServerSimple::set_bind_host(const String &val) {
|
||||
_bind_host = val;
|
||||
}
|
||||
|
||||
bool WebServerSimple::get_start_on_ready() {
|
||||
return _start_on_ready;
|
||||
}
|
||||
void WebServerSimple::set_start_on_ready(const bool val) {
|
||||
_start_on_ready = val;
|
||||
}
|
||||
|
||||
bool WebServerSimple::get_use_ssl() {
|
||||
return _use_ssl;
|
||||
}
|
||||
@ -222,6 +229,8 @@ WebServerSimple::WebServerSimple() {
|
||||
_bind_port = 8080;
|
||||
_bind_host = "0.0.0.0";
|
||||
|
||||
_start_on_ready = false;
|
||||
|
||||
_use_ssl = false;
|
||||
|
||||
_use_worker_threads = true;
|
||||
@ -254,12 +263,21 @@ void WebServerSimple::_apply_max_request_size_type() {
|
||||
}
|
||||
|
||||
void WebServerSimple::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
|
||||
if (_single_threaded_poll) {
|
||||
_server_lock.lock();
|
||||
_server->poll();
|
||||
_server_lock.unlock();
|
||||
}
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||
if (_single_threaded_poll) {
|
||||
_server_lock.lock();
|
||||
_server->poll();
|
||||
_server_lock.unlock();
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_READY: {
|
||||
if (_start_on_ready) {
|
||||
start();
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,6 +290,10 @@ void WebServerSimple::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_bind_host", "val"), &WebServerSimple::set_bind_host);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "bind_host"), "set_bind_host", "get_bind_host");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_start_on_ready"), &WebServerSimple::get_start_on_ready);
|
||||
ClassDB::bind_method(D_METHOD("set_start_on_ready", "val"), &WebServerSimple::set_start_on_ready);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "start_on_ready"), "set_start_on_ready", "get_start_on_ready");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_use_ssl"), &WebServerSimple::get_use_ssl);
|
||||
ClassDB::bind_method(D_METHOD("set_use_ssl", "val"), &WebServerSimple::set_use_ssl);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_ssl"), "set_use_ssl", "get_use_ssl");
|
||||
|
@ -60,6 +60,9 @@ public:
|
||||
String get_bind_host();
|
||||
void set_bind_host(const String &val);
|
||||
|
||||
bool get_start_on_ready();
|
||||
void set_start_on_ready(const bool val);
|
||||
|
||||
bool get_use_ssl();
|
||||
void set_use_ssl(const bool val);
|
||||
|
||||
@ -111,6 +114,8 @@ protected:
|
||||
int _bind_port;
|
||||
String _bind_host;
|
||||
|
||||
bool _start_on_ready;
|
||||
|
||||
//TODO add binds to set path
|
||||
bool _use_ssl;
|
||||
String _ssl_key;
|
||||
|
Loading…
Reference in New Issue
Block a user