WIP conn2
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user