Remove large community editing support via RPC for now.
Some checks are pending
Rust / build (push) Waiting to run
Some checks are pending
Rust / build (push) Waiting to run
This commit is contained in:
@ -122,49 +122,6 @@ async fn start_http_server(
|
||||
}
|
||||
}
|
||||
|
||||
// async fn rm_large_community(
|
||||
// chan: UnboundedSender<PeerCommands>,
|
||||
// ld1: u32,
|
||||
// ld2: u32,
|
||||
// ) -> Result<impl warp::Reply, warp::Rejection> {
|
||||
// let (tx, rx) = tokio::sync::oneshot::channel::<String>();
|
||||
// if let Err(e) = chan.send(PeerCommands::RemoveLargeCommunity((ld1, ld2), tx)) {
|
||||
// warn!("Failed to send RemoveLargeCommunity request: {}", e);
|
||||
// return Err(warp::reject());
|
||||
// }
|
||||
|
||||
// match rx.await {
|
||||
// Ok(result) => Ok(warp::reply::json(&result)),
|
||||
// Err(e) => {
|
||||
// warn!(
|
||||
// "RemoveLargeCommunity response from peer state machine: {}",
|
||||
// e
|
||||
// );
|
||||
// Err(warp::reject())
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// async fn add_large_community(
|
||||
// chan: UnboundedSender<PeerCommands>,
|
||||
// ld1: u32,
|
||||
// ld2: u32,
|
||||
// ) -> Result<impl warp::Reply, warp::Rejection> {
|
||||
// let (tx, rx) = tokio::sync::oneshot::channel::<String>();
|
||||
// if let Err(e) = chan.send(PeerCommands::AddLargeCommunity((ld1, ld2), tx)) {
|
||||
// warn!("Failed to send AddLargeCommunity request: {}", e);
|
||||
// return Err(warp::reject());
|
||||
// }
|
||||
|
||||
// match rx.await {
|
||||
// Ok(result) => Ok(warp::reply::json(&result)),
|
||||
// Err(e) => {
|
||||
// warn!("AddLargeCommunity response from peer state machine: {}", e);
|
||||
// Err(warp::reject())
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// reset_peer_connection causes the PSM to close the connection, flush state, and reconnect to the peer.
|
||||
async fn reset_peer_connection(
|
||||
peer_name: String,
|
||||
|
||||
@ -124,10 +124,6 @@ pub enum PeerCommands {
|
||||
|
||||
TimerEvent(PeerTimerEvent),
|
||||
|
||||
// Adds a community to all announcements.
|
||||
AddLargeCommunity((u32, u32), oneshot::Sender<String>),
|
||||
RemoveLargeCommunity((u32, u32), oneshot::Sender<String>),
|
||||
|
||||
// GetStatus is a crude hack to get a status string out of the PSM for debugging.
|
||||
GetStatus(oneshot::Sender<PeerStatus>),
|
||||
}
|
||||
@ -523,47 +519,6 @@ where
|
||||
todo!();
|
||||
}
|
||||
|
||||
PeerCommands::AddLargeCommunity(c, sender) => {
|
||||
for a in self.config.announcements.iter_mut() {
|
||||
if let Some(lcs) = a.large_communities.as_mut() {
|
||||
lcs.push(format!("{}:{}:{}", self.config.asn, c.0, c.1));
|
||||
} else {
|
||||
a.large_communities =
|
||||
Some(vec![format!("{}:{}:{}", self.config.asn, c.0, c.1)]);
|
||||
}
|
||||
}
|
||||
for a in &self.config.announcements.clone() {
|
||||
if let Err(e) = self.announce_static(&a).await {
|
||||
if let Err(se) = sender.send(e) {
|
||||
warn!("Failed to send to sender: {}", se);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
if let Err(se) = sender.send("Ok".to_string()) {
|
||||
warn!("Failed to send to sender: {}", se);
|
||||
}
|
||||
}
|
||||
PeerCommands::RemoveLargeCommunity(c, sender) => {
|
||||
let communities_str = format!("{}:{}:{}", self.config.asn, c.0, c.1);
|
||||
for a in self.config.announcements.iter_mut() {
|
||||
if let Some(lcs) = a.large_communities.as_mut() {
|
||||
lcs.retain(|e| *e != communities_str);
|
||||
}
|
||||
}
|
||||
for a in &self.config.announcements.clone() {
|
||||
if let Err(e) = self.announce_static(&a).await {
|
||||
if let Err(se) = sender.send(e) {
|
||||
warn!("Failed to send to sender: {}", se);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
if let Err(se) = sender.send("Ok".to_string()) {
|
||||
warn!("Failed to send to sender: {}", se);
|
||||
}
|
||||
}
|
||||
|
||||
PeerCommands::MessageFromPeer(msg) => match self.handle_msg(msg).await {
|
||||
Ok(_) => {
|
||||
let mut last_time = self
|
||||
|
||||
Reference in New Issue
Block a user