This commit is contained in:
Dominik Werder
2023-11-01 09:57:39 +01:00
parent f7db475b30
commit 35f0bcb41f
10 changed files with 91 additions and 529 deletions

View File

@@ -47,13 +47,16 @@ impl Stream for InputMerge {
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
use Poll::*;
let selfp = self.project();
let ret = {
if let Some(inp) = selfp.inp3.as_pin_mut() {
let mut selfp = self.as_mut().project();
if let Some(inp) = selfp.inp3.as_mut().as_pin_mut() {
match inp.poll_next(cx) {
Ready(Some(x)) => Some(CaConnSetEvent::ConnSetCmd(todo!())),
Ready(None) => {
// self.inp3 = None;
unsafe {
// TODO what guarantees that I can drop the content here like this?
self.as_mut().get_unchecked_mut().inp3 = None;
}
None
}
Pending => None,
@@ -65,11 +68,15 @@ impl Stream for InputMerge {
let ret = if let Some(x) = ret {
Some(x)
} else {
if let Some(inp) = selfp.inp2.as_pin_mut() {
let mut selfp = self.as_mut().project();
if let Some(inp) = selfp.inp2.as_mut().as_pin_mut() {
match inp.poll_next(cx) {
Ready(Some(x)) => Some(CaConnSetEvent::ConnSetCmd(todo!())),
Ready(None) => {
// self.inp2 = None;
unsafe {
// TODO what guarantees that I can drop the content here like this?
self.as_mut().get_unchecked_mut().inp2 = None;
}
None
}
Pending => None,
@@ -81,11 +88,15 @@ impl Stream for InputMerge {
if let Some(x) = ret {
Ready(Some(x))
} else {
if let Some(inp) = selfp.inp1.as_pin_mut() {
let mut selfp = self.as_mut().project();
if let Some(inp) = selfp.inp1.as_mut().as_pin_mut() {
match inp.poll_next(cx) {
Ready(Some(x)) => Ready(Some(x)),
Ready(None) => {
// self.inp1 = None;
unsafe {
// TODO what guarantees that I can drop the content here like this?
self.as_mut().get_unchecked_mut().inp1 = None;
}
Ready(None)
}
Pending => Pending,

View File

@@ -217,7 +217,7 @@ async fn finder_worker_single(
items.extend(to_add.into_iter());
let items = items;
for e in &items {
if crate::ca::connset::trigger.contains(&e.channel.as_str()) {
if true || crate::ca::connset::trigger.contains(&e.channel.as_str()) {
debug!("found in database: {e:?}");
}
}
@@ -262,6 +262,7 @@ async fn finder_network_if_not_found(
let mut res = VecDeque::new();
let mut net = VecDeque::new();
for e in item {
trace!("finder_network_if_not_found sees {e:?}");
if e.addr.is_none() {
net.push_back(e.channel);
} else {

View File

@@ -402,13 +402,14 @@ impl CaMsgTy {
fn payload_len(&self) -> usize {
use CaMsgTy::*;
trace!("payload_len for {self:?}");
match self {
Version => 0,
VersionRes(_) => 0,
Error(x) => (16 + x.msg.len() + 1 + 7) / 8 * 8,
ClientName => 0x10,
ClientNameRes(x) => (x.name.len() + 1 + 7) / 8 * 8,
HostName(_) => 0x18,
HostName(x) => (x.len() + 1 + 7) / 8 * 8,
Search(x) => (x.channel.len() + 1 + 7) / 8 * 8,
SearchRes(_) => 8,
CreateChan(x) => (x.channel.len() + 1 + 7) / 8 * 8,