Skip to content

Commit 0363e7c

Browse files
committed
use alloc and core libs instead of std whenever possible
1 parent 456a32e commit 0363e7c

File tree

7 files changed

+9
-68
lines changed

7 files changed

+9
-68
lines changed

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ setup_starpls(
2323
copyright_checker(
2424
name = "copyright",
2525
srcs = [
26+
"src",
2627
"tests",
2728
"//:BUILD",
2829
"//:MODULE.bazel",

examples/rust/mini-adas/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ com_iox2 = ["feo-com/ipc_iceoryx2"]
3333
com_linux_shm = ["feo-com/ipc_linux_shm"]
3434
default = ["com_iox2", "signalling_relayed_tcp"]
3535
signalling_direct_mpsc = []
36-
signalling_direct_tcp = ["com_iox2"]
36+
signalling_direct_tcp = []
3737
signalling_direct_unix = []
3838
signalling_relayed_tcp = []
3939
signalling_relayed_unix = []

feo/src/agent/direct/primary.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ use core::sync::atomic::AtomicBool;
3030
use core::time::Duration;
3131
use feo_log::info;
3232
use std::collections::HashMap;
33-
<<<<<<< HEAD
34-
=======
35-
use std::sync::{atomic::AtomicBool, Arc};
36-
>>>>>>> 999c8dd (ctrlc is not built after rebasing)
3733
use std::thread::{self, JoinHandle};
3834

3935
/// Configuration of the primary agent
@@ -75,10 +71,7 @@ impl Primary {
7571
recorder_ids,
7672
endpoint,
7773
timeout,
78-
<<<<<<< HEAD
7974
connection_timeout,
80-
=======
81-
>>>>>>> 999c8dd (ctrlc is not built after rebasing)
8275
activity_agent_map,
8376
..
8477
} = config;

feo/src/scheduler.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,13 @@ impl Scheduler {
390390
}
391391
break id;
392392
}
393-
Some(Signal::TerminateAck(_)) => continue, // Ignore during normal operation
393+
Some(Signal::TerminateAck(agent_id)) => {
394+
trace!(
395+
"Ignoring TerminateAck from agent {} during normal operation",
396+
agent_id
397+
);
398+
continue;
399+
}
394400
Some(other) => {
395401
error!("Received unexpected signal {other:?} while waiting for ready signal");
396402
}

feo/src/signalling/direct/scheduler.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ where
135135
let start_time = Instant::now();
136136

137137
while !missing_activities.is_empty() || !missing_recorders.is_empty() {
138-
<<<<<<< HEAD
139138
let elapsed = start_time.elapsed();
140139
if elapsed >= self.connection_timeout {
141140
return Err(Error::Io((
@@ -147,11 +146,6 @@ where
147146
// Wait for a new connection, but no longer than the remaining overall timeout.
148147
if let Ok(Some((token, signal))) =
149148
self.server.receive(&mut self.events, remaining_timeout)
150-
=======
151-
if let Ok(Some((token, signal))) = self
152-
.server
153-
.receive(&mut self.events, Duration::from_secs(1))
154-
>>>>>>> 999c8dd (ctrlc is not built after rebasing)
155149
{
156150
match signal {
157151
ProtocolSignal::ActivityHello(activity_id) => {

feo/src/signalling/relayed/connectors/relays.rs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,8 @@ impl<Inter: IsChannel, Intra: IsChannel> PrimaryReceiveRelay<Inter, Intra> {
5353
let inter_receiver_builder = self.inter_receiver_builder.take().unwrap();
5454
let intra_sender_builder = self.intra_sender_builder.take().unwrap();
5555
let timeout = self.timeout;
56-
<<<<<<< HEAD
5756

5857
thread::spawn(move || {
59-
=======
60-
let thread = thread::spawn(move || {
61-
>>>>>>> 999c8dd (ctrlc is not built after rebasing)
6258
if let Err(e) = Self::thread_main(inter_receiver_builder, intra_sender_builder, timeout)
6359
{
6460
// This error is expected during shutdown when the scheduler drops its receiver.
@@ -140,48 +136,6 @@ impl<Inter: IsChannel, Intra: IsChannel> PrimaryReceiveRelay<Inter, Intra> {
140136
trace!("PrimaryReceiveRelay connected");
141137
Ok((inter_receiver, intra_sender))
142138
}
143-
<<<<<<< HEAD
144-
=======
145-
146-
pub fn connect(&mut self) -> Result<(), Error> {
147-
self.inter_sender.connect_receivers(self.timeout)?;
148-
trace!("PrimarySendRelay connected");
149-
Ok(())
150-
}
151-
152-
pub fn get_remote_agents(&self) -> impl Iterator<Item = AgentId> + '_ {
153-
self.remote_agents.iter().copied()
154-
}
155-
156-
pub fn send_to_agent(
157-
&mut self,
158-
agent_id: AgentId,
159-
signal: Inter::ProtocolSignal,
160-
) -> Result<(), Error> {
161-
let channel_id = ChannelId::Agent(agent_id);
162-
self.inter_sender.send(channel_id, signal)
163-
}
164-
165-
pub fn sync_time(&mut self) -> Result<(), Error> {
166-
let signal = Signal::StartupSync(sync_info());
167-
168-
// Send sync info to all remote agents
169-
for id in self.remote_agents.iter() {
170-
let channel_id = ChannelId::Agent(*id);
171-
self.inter_sender.send(channel_id, signal.into())?;
172-
}
173-
Ok(())
174-
}
175-
176-
pub fn broadcast(&mut self, signal: Inter::ProtocolSignal) -> Result<(), Error> {
177-
// Send signal to all remote agents
178-
for id in self.remote_agents.iter() {
179-
let channel_id = ChannelId::Agent(*id);
180-
self.inter_sender.send(channel_id, signal)?;
181-
}
182-
Ok(())
183-
}
184-
>>>>>>> 999c8dd (ctrlc is not built after rebasing)
185139
}
186140

187141
/// Relay for a secondary to receive signals from the primary agent

feo/src/signalling/relayed/connectors/scheduler.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,10 @@ use crate::signalling::relayed::connectors::relays::{PrimaryReceiveRelay, Primar
2121
use crate::signalling::relayed::interface::{
2222
Builder, IsChannel, ProtocolMultiRecv, ProtocolMultiSend,
2323
};
24-
<<<<<<< HEAD
2524
use alloc::{collections::BTreeSet, vec::Vec};
2625
use core::time::Duration;
2726
use feo_log::debug;
2827
use std::collections::{HashMap, HashSet};
29-
=======
30-
use alloc::vec::Vec;
31-
use core::time::Duration;
32-
use feo_log::debug;
33-
use std::collections::{BTreeSet, HashMap, HashSet};
34-
>>>>>>> 999c8dd (ctrlc is not built after rebasing)
3528
use std::thread::JoinHandle;
3629

3730
pub(crate) struct SchedulerConnector<Inter: IsChannel, Intra: IsChannel> {

0 commit comments

Comments
 (0)