increase limits
This commit is contained in:
@@ -584,20 +584,19 @@ impl eframe::App for RealmApp {
|
|||||||
for server in missing_servers {
|
for server in missing_servers {
|
||||||
let send_channel = self.event_channel.0.clone();
|
let send_channel = self.event_channel.0.clone();
|
||||||
let _handle = tokio::spawn(async move {
|
let _handle = tokio::spawn(async move {
|
||||||
|
let mut transport = tarpc::serde_transport::tcp::connect(format!("{}:{}", server.domain, server.port), Json::default);
|
||||||
|
transport.config_mut().max_frame_length(usize::MAX);
|
||||||
|
|
||||||
|
let result = transport.await;
|
||||||
|
let connection = match result {
|
||||||
|
Ok(connection) => connection,
|
||||||
|
Err(_) => {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let client = RealmChatClient::new(tarpc::client::Config::default(), connection).spawn();
|
||||||
loop {
|
loop {
|
||||||
let mut transport = tarpc::serde_transport::tcp::connect(format!("{}:{}", server.domain, server.port), Json::default);
|
|
||||||
transport.config_mut().max_frame_length(usize::MAX);
|
|
||||||
|
|
||||||
let result = transport.await;
|
|
||||||
let connection = match result {
|
|
||||||
Ok(connection) => connection,
|
|
||||||
Err(_) => {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let client = RealmChatClient::new(tarpc::client::Config::default(), connection).spawn();
|
|
||||||
|
|
||||||
let result = client.poll_events_since(
|
let result = client.poll_events_since(
|
||||||
context::current(),
|
context::current(),
|
||||||
server.last_event_index
|
server.last_event_index
|
||||||
@@ -612,7 +611,7 @@ impl eframe::App for RealmApp {
|
|||||||
Err(_) => break,
|
Err(_) => break,
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep(Duration::from_millis(75)).await;
|
sleep(Duration::from_millis(1000)).await;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,8 +223,8 @@ pub fn rooms(app: &mut RealmApp, ctx: &Context) {
|
|||||||
pub fn messages(app: &mut RealmApp, ctx: &Context) {
|
pub fn messages(app: &mut RealmApp, ctx: &Context) {
|
||||||
egui::CentralPanel::default().show(ctx, |ui| {
|
egui::CentralPanel::default().show(ctx, |ui| {
|
||||||
ui.with_layout(egui::Layout::bottom_up(egui::Align::TOP), |ui| {
|
ui.with_layout(egui::Layout::bottom_up(egui::Align::TOP), |ui| {
|
||||||
ui.with_layout(egui::Layout::left_to_right(egui::Align::TOP), |ui| {
|
ui.with_layout(egui::Layout::right_to_left(egui::Align::TOP), |ui| {
|
||||||
if ui.button("").on_hover_text("Send a message").clicked() {
|
if ui.button("✉").on_hover_text("Send a message").clicked() {
|
||||||
if let Some(active_servers) = &app.active_servers {
|
if let Some(active_servers) = &app.active_servers {
|
||||||
for server in active_servers.clone() {
|
for server in active_servers.clone() {
|
||||||
if server.server_id.eq(&app.selected_serverid) {
|
if server.server_id.eq(&app.selected_serverid) {
|
||||||
@@ -245,6 +245,8 @@ pub fn messages(app: &mut RealmApp, ctx: &Context) {
|
|||||||
}
|
}
|
||||||
).await;
|
).await;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.text_message_input.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
.filter_map(|r| future::ready(r.ok()))
|
.filter_map(|r| future::ready(r.ok()))
|
||||||
.map(BaseChannel::with_defaults)
|
.map(BaseChannel::with_defaults)
|
||||||
// Limit channels to 1 per IP.
|
// Limit channels to 1 per IP.
|
||||||
.max_channels_per_key(1, |t| t.transport().peer_addr().unwrap().ip())
|
.max_channels_per_key(2048, |t| t.transport().peer_addr().unwrap().ip())
|
||||||
// serve is generated by the service attribute. It takes as input any type implementing
|
// serve is generated by the service attribute. It takes as input any type implementing
|
||||||
// the generated World trait.
|
// the generated World trait.
|
||||||
.map(|channel| {
|
.map(|channel| {
|
||||||
@@ -101,7 +101,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
channel.execute(server.serve()).for_each(spawn)
|
channel.execute(server.serve()).for_each(spawn)
|
||||||
})
|
})
|
||||||
// Max 10 channels.
|
// Max 10 channels.
|
||||||
.buffer_unordered(10)
|
.buffer_unordered(4096)
|
||||||
.for_each(|_| async {})
|
.for_each(|_| async {})
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user