Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not monitor writable events for ws server #2646

Merged
merged 3 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tee-worker/core/tls-websocket-server/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ where
match tls_session.process_new_packets() {
Ok(_) => {
if tls_session.is_handshaking() {
trace!("TLS session is in handshake");
return ConnectionState::TlsHandshake
}
ConnectionState::Alive
Expand Down
10 changes: 10 additions & 0 deletions tee-worker/core/tls-websocket-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,14 @@ pub(crate) trait WebSocketConnection: Send + Sync {
None => Err(WebSocketError::ConnectionClosed),
}
}

fn deregister(&mut self, poll: &mio::Poll) -> WebSocketResult<()> {
match self.socket() {
Some(s) => {
poll.deregister(s)?;
Ok(())
},
None => Err(WebSocketError::ConnectionClosed),
}
}
}
2 changes: 1 addition & 1 deletion tee-worker/core/tls-websocket-server/src/stream_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl<S: Read + Write> MaybeServerTlsStream<S> {

pub fn wants_write(&self) -> bool {
match self {
MaybeServerTlsStream::Plain(_) => true,
MaybeServerTlsStream::Plain(_) => false, // do not monitor writable events for non-tls server
MaybeServerTlsStream::Rustls(s) => s.sess.wants_write(),
}
}
Expand Down
1 change: 1 addition & 0 deletions tee-worker/core/tls-websocket-server/src/ws_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ where

if connection.is_closed() {
trace!("Connection {:?} is closed, removing", token);
connection.deregister(poll)?;
connections_lock.remove(&token);
trace!(
"Closed {:?}, {} active connections remaining",
Expand Down
2 changes: 1 addition & 1 deletion ts-tests/integration-tests/evm-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describeLitentry('Test EVM Module Contract', ``, (context) => {
console.log(`Tx successful with hash: ${createReceipt.transactionHash}`);
};
const setMsg = await setMessage(deployed.contractAddress!, evmAccountRaw, 'Goodbye World');
const sayMsg = await sayMessage(deployed.contractAddress!)
const sayMsg = await sayMessage(deployed.contractAddress!);
const setResult = sayMsg === 'Goodbye World' ? 1 : 0;
assert.equal(1, setResult, 'Contract modified storage query mismatch');

Expand Down
Loading