Decrease max message size to 16MB
This commit is contained in:
parent
40cab75f96
commit
6b81cec83a
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -403,9 +403,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "async-psec"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6aa693cf79f81392aeffa439d2aae418d8d04816e86c0032a3e80e8b5df0b743"
|
||||
checksum = "589ceb2d0c6d841e27084dac8599b84436b9024dc047f71963c7460c31f1e8f5"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"async-trait",
|
||||
|
@ -4,4 +4,5 @@ pub const APPLICATION_FOLDER: &str = "AIRA";
|
||||
pub const DB_NAME: &str = "AIRA.db";
|
||||
pub const HTTP_COOKIE_NAME: &str = "aira_auth";
|
||||
pub const MSG_LOADING_COUNT: usize = 20;
|
||||
pub const FILE_CHUNK_SIZE: usize = 1023996;
|
||||
pub const FILE_CHUNK_SIZE: usize = 1_023_996;
|
||||
pub const MAX_RECV_SIZE: usize = 16_383_996;
|
@ -174,7 +174,7 @@ document.getElementById("attach_file").onchange = function(event) {
|
||||
let files = event.target.files;
|
||||
let useLargeFileTransfer = false;
|
||||
for (let i=0; i<files.length; ++i) {
|
||||
if (files[i].size > 32760000) {
|
||||
if (files[i].size > 16380000) {
|
||||
useLargeFileTransfer = true;
|
||||
break;
|
||||
}
|
||||
@ -215,7 +215,7 @@ document.getElementById("attach_file").onchange = function(event) {
|
||||
formData.append("", files[i]);
|
||||
fetch("/send_file", {method: "POST", body: formData}).then(response => {
|
||||
if (response.ok) {
|
||||
response.text().then(uuid => onFileSent(currentSessionId, new Date.now(), uuid, files[i].name));
|
||||
response.text().then(uuid => onFileSent(currentSessionId, new Date(), uuid, files[i].name));
|
||||
} else {
|
||||
console.log(response);
|
||||
}
|
||||
@ -1193,4 +1193,4 @@ function displayHistory(scrollToBottom = true) {
|
||||
socket.send("load_msgs "+currentSessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,10 @@ impl SessionManager {
|
||||
}
|
||||
}
|
||||
if !msg_saved {
|
||||
self.saved_msgs.write().unwrap().get_mut(&session_id).unwrap().push(message);
|
||||
//can be None if session disconnected
|
||||
if let Some(saved_msgs) = self.saved_msgs.write().unwrap().get_mut(&session_id) {
|
||||
saved_msgs.push(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,7 +415,7 @@ impl SessionManager {
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
if e != PsecError::BrokenPipe && e != PsecError::ConnectionReset && e != PsecError::BufferTooLarge {
|
||||
if e != PsecError::BrokenPipe && e != PsecError::ConnectionReset {
|
||||
print_error!(e);
|
||||
}
|
||||
break;
|
||||
@ -468,6 +471,7 @@ impl SessionManager {
|
||||
fn handle_new_session(session_manager: Arc<SessionManager>, mut session: Session, outgoing: bool) {
|
||||
tokio::spawn(async move {
|
||||
let mut peer_public_key = [0; PUBLIC_KEY_LENGTH];
|
||||
session.set_max_recv_size(constants::MAX_RECV_SIZE, false);
|
||||
let session = {
|
||||
let identity = {
|
||||
session_manager.identity.read().unwrap().clone()
|
||||
|
Loading…
Reference in New Issue
Block a user