Marginal improvements to cross thread access.
This commit is contained in:
parent
e1e3def62c
commit
c21605cf3b
16 changed files with 586 additions and 814 deletions
SharpChat
|
@ -1,4 +1,5 @@
|
|||
using SharpChat.Config;
|
||||
using SharpChat.EventStorage;
|
||||
using SharpChat.Misuzu;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
@ -46,8 +47,6 @@ namespace SharpChat {
|
|||
|
||||
using IConfig config = new StreamConfig(configFile);
|
||||
|
||||
Database.Init(config.ScopeTo("mariadb"));
|
||||
|
||||
if(hasCancelled) return;
|
||||
|
||||
using HttpClient httpClient = new(new HttpClientHandler() {
|
||||
|
@ -61,7 +60,18 @@ namespace SharpChat {
|
|||
|
||||
if(hasCancelled) return;
|
||||
|
||||
using SockChatServer scs = new(httpClient, msz, config.ScopeTo("chat"));
|
||||
IEventStorage evtStore;
|
||||
if(string.IsNullOrWhiteSpace(config.SafeReadValue("mariadb:host", string.Empty))) {
|
||||
evtStore = new VirtualEventStorage();
|
||||
} else {
|
||||
MariaDBEventStorage mdbes = new(MariaDBEventStorage.BuildConnString(config.ScopeTo("mariadb")));
|
||||
evtStore = mdbes;
|
||||
mdbes.RunMigrations();
|
||||
}
|
||||
|
||||
if(hasCancelled) return;
|
||||
|
||||
using SockChatServer scs = new(httpClient, msz, evtStore, config.ScopeTo("chat"));
|
||||
scs.Listen(mre);
|
||||
|
||||
mre.WaitOne();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue