This commit is contained in:
ntr 2019-11-20 12:14:37 +11:00
parent f850a8806b
commit 40ca99d185
3 changed files with 14 additions and 11 deletions

View File

@ -6,7 +6,6 @@
* can't reset password without knowing password =\ * can't reset password without knowing password =\
* ws gzip encoding * ws gzip encoding
* skip faceoff for practice
* concede round * concede round
* look into ruin event bug * look into ruin event bug

View File

@ -34,7 +34,7 @@ router = "0.6"
mount = "0.4" mount = "0.4"
cookie = "0.12" cookie = "0.12"
crossbeam-channel = "0.3" crossbeam-channel = "0.3"
ws = { version = "0.8", features = ["ssl"] } ws = { version = "0.8", features = ["ssl", "permessage-deflate"] }
lettre = "0.9" lettre = "0.9"
lettre_email = "0.9" lettre_email = "0.9"

View File

@ -16,6 +16,7 @@ use stripe::{Client as StripeClient, Subscription};
use crossbeam_channel::{unbounded, Sender as CbSender}; use crossbeam_channel::{unbounded, Sender as CbSender};
use ws::{Builder, CloseCode, Message, Handler, Request, Response, Settings, Sender as WsSender}; use ws::{Builder, CloseCode, Message, Handler, Request, Response, Settings, Sender as WsSender};
use ws::deflate::DeflateHandler;
use account::{Account}; use account::{Account};
use account; use account;
@ -448,7 +449,8 @@ impl Handler for Connection {
pub fn start(pool: PgPool, events_tx: CbSender<Event>, stripe: StripeClient) { pub fn start(pool: PgPool, events_tx: CbSender<Event>, stripe: StripeClient) {
let mut rng = thread_rng(); let mut rng = thread_rng();
Builder::new()
let ws = Builder::new()
.with_settings(Settings { .with_settings(Settings {
max_connections: 10_000, max_connections: 10_000,
..Settings::default() ..Settings::default()
@ -478,14 +480,16 @@ pub fn start(pool: PgPool, events_tx: CbSender<Event>, stripe: StripeClient) {
} }
}); });
Connection { DeflateHandler::new(
id: rng.gen::<usize>(), Connection {
account: None, id: rng.gen::<usize>(),
ws: tx, account: None,
pool: pool.clone(), ws: tx,
stripe: stripe.clone(), pool: pool.clone(),
events: events_tx.clone(), stripe: stripe.clone(),
} events: events_tx.clone(),
}
)
}) })
.unwrap() .unwrap()
.listen("127.0.0.1:40055") .listen("127.0.0.1:40055")