Skip to content

Commit 278922f

Browse files
committed
WIP: TSI/TCP fix
Signed-off-by: Matej Hrica <[email protected]>
1 parent 894fa27 commit 278922f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/devices/src/virtio/vsock/proxy.rs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub enum ProxyError {
2525
pub enum ProxyStatus {
2626
Idle,
2727
Connecting,
28+
ConnectedUnconfirmed,
2829
Connected,
2930
Listening,
3031
Closed,

src/devices/src/virtio/vsock/tcp.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ impl TcpProxy {
341341
}
342342

343343
fn switch_to_connected(&mut self) {
344-
self.status = ProxyStatus::Connected;
344+
self.status = ProxyStatus::ConnectedUnconfirmed;
345345
match fcntl(self.fd, FcntlArg::F_GETFL) {
346346
Ok(flags) => match OFlag::from_bits(flags) {
347347
Some(flags) => {
@@ -395,7 +395,7 @@ impl Proxy for TcpProxy {
395395
if self.status == ProxyStatus::Connecting {
396396
update.polling = Some((self.id, self.fd, EventSet::IN | EventSet::OUT));
397397
} else {
398-
if self.status == ProxyStatus::Connected {
398+
if self.status == ProxyStatus::ConnectedUnconfirmed {
399399
update.polling = Some((self.id, self.fd, EventSet::IN));
400400
}
401401
self.push_connect_rsp(result);
@@ -413,6 +413,15 @@ impl Proxy for TcpProxy {
413413
self.peer_port,
414414
);
415415

416+
if self.status != ProxyStatus::ConnectedUnconfirmed {
417+
warn!(
418+
"tcp: confirm_connect: Expected state to be {:?}, but it is {:?}",
419+
ProxyStatus::ConnectedUnconfirmed,
420+
self.status
421+
);
422+
}
423+
self.status = ProxyStatus::Connected;
424+
416425
self.peer_buf_alloc = pkt.buf_alloc();
417426
self.peer_fwd_cnt = Wrapping(pkt.fwd_cnt());
418427

0 commit comments

Comments
 (0)