Mercurial > prosody-hg
comparison util/startup.lua @ 11948:dca75cc6fc5a
util.startup: Integrate util.promise with net.server main loop
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 05 Jan 2019 07:15:33 +0100 |
| parents | 1d1ed2be3491 |
| children | f5c6be4a3ecc |
comparison
equal
deleted
inserted
replaced
| 11947:073e53b72792 | 11948:dca75cc6fc5a |
|---|---|
| 391 local http = require "net.http" | 391 local http = require "net.http" |
| 392 local config_ssl = config.get("*", "ssl") or {} | 392 local config_ssl = config.get("*", "ssl") or {} |
| 393 local https_client = config.get("*", "client_https_ssl") | 393 local https_client = config.get("*", "client_https_ssl") |
| 394 http.default.options.sslctx = require "core.certmanager".create_context("client_https port 0", "client", | 394 http.default.options.sslctx = require "core.certmanager".create_context("client_https port 0", "client", |
| 395 { capath = config_ssl.capath, cafile = config_ssl.cafile, verify = "peer", }, https_client); | 395 { capath = config_ssl.capath, cafile = config_ssl.cafile, verify = "peer", }, https_client); |
| 396 end | |
| 397 | |
| 398 function startup.init_promise() | |
| 399 local promise = require "util.promise"; | |
| 400 | |
| 401 local timer = require "util.timer"; | |
| 402 promise.set_nexttick(function(f) return timer.add_task(0, f); end); | |
| 396 end | 403 end |
| 397 | 404 |
| 398 function startup.init_data_store() | 405 function startup.init_data_store() |
| 399 require "core.storagemanager"; | 406 require "core.storagemanager"; |
| 400 end | 407 end |
| 645 startup.add_global_prosody_functions(); | 652 startup.add_global_prosody_functions(); |
| 646 startup.read_version(); | 653 startup.read_version(); |
| 647 startup.log_greeting(); | 654 startup.log_greeting(); |
| 648 startup.log_startup_warnings(); | 655 startup.log_startup_warnings(); |
| 649 startup.load_secondary_libraries(); | 656 startup.load_secondary_libraries(); |
| 657 startup.init_promise(); | |
| 650 startup.init_http_client(); | 658 startup.init_http_client(); |
| 651 startup.init_data_store(); | 659 startup.init_data_store(); |
| 652 startup.init_global_protection(); | 660 startup.init_global_protection(); |
| 653 startup.prepare_to_start(); | 661 startup.prepare_to_start(); |
| 654 startup.notify_started(); | 662 startup.notify_started(); |
