WIP conn2

This commit is contained in:
Dominik Werder
2025-02-17 17:55:58 +01:00
parent e2008a3a5a
commit 9a81e25625
4 changed files with 10 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "daqingest"
version = "0.2.7-aa.0"
version = "0.2.7-aa.1"
authors = ["Dominik Werder <dominik.werder@gmail.com>"]
edition = "2021"

View File

@@ -77,7 +77,7 @@ enum ConnectedState {
#[derive(Debug)]
enum CaConnState {
Connecting(Connecting),
Connected(CaProto),
Connected(Connected),
Shutdown(EndOfStreamReason),
Done,
}
@@ -313,12 +313,14 @@ impl Stream for CaConn {
// }
// }
let tsnow4 = Instant::now();
match &mut self.state {
CaConnState::Connecting(st2) => match st2.poll_unpin(cx) {
Ready(x) => match x {
Ok(Some(x)) => {
hpp.have_progress();
self.state = CaConnState::Connected(Connected::new(x));
self.state = CaConnState::Connected(Connected::new(st2.addr(), x, tsnow4));
}
Ok(None) => {
// TODO

View File

@@ -42,7 +42,7 @@ impl fmt::Debug for Connected {
}
impl Connected {
pub fn new(tcp: TcpStream) -> Self {
pub fn new(remote_addr: SocketAddrV4, tcp: TcpStream, tsnow: Instant) -> Self {
Self {
tsbeg: tsnow,
addr: remote_addr,

View File

@@ -50,6 +50,10 @@ impl Connecting {
}
}
pub fn addr(&self) -> SocketAddrV4 {
self.addr
}
pub fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<Option<PollType>, Error>> {
use Poll::*;
match self.fut.poll_unpin(cx) {