diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-09-26 17:38:54 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-09-26 17:39:36 +0800 |
| commit | 4951e2e98bab7a2996893939ee77f0279145b556 (patch) | |
| tree | 78138b8564d132edba20226a7522532746bfb79e /crates/utils/tcp_connection/src/target_configure.rs | |
| parent | e8160eda1b68a42b8d861bbec5e9c1dc555ea783 (diff) | |
refactor: downgrade tcp_connection functionality to test utilities
- Remove handle, target, target_configure, target_connection modules from main library
- Create test_utils module in test project to contain temporary connection functionality
- Update import paths in test files
- Keep instance and error modules as core functionality
- Adjust vcs_test configurations to adapt to new test structure
Diffstat (limited to 'crates/utils/tcp_connection/src/target_configure.rs')
| -rw-r--r-- | crates/utils/tcp_connection/src/target_configure.rs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/crates/utils/tcp_connection/src/target_configure.rs b/crates/utils/tcp_connection/src/target_configure.rs deleted file mode 100644 index d739ac9..0000000 --- a/crates/utils/tcp_connection/src/target_configure.rs +++ /dev/null @@ -1,53 +0,0 @@ -use serde::{Deserialize, Serialize}; - -#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize)] -pub struct ServerTargetConfig { - /// Only process a single connection, then shut down the server. - once: bool, - - /// Timeout duration in milliseconds. (0 is Closed) - timeout: u64, -} - -impl ServerTargetConfig { - /// Set `once` to True - /// This method configures the `once` field of `ServerTargetConfig`. - pub fn once(mut self) -> Self { - self.once = true; - self - } - - /// Set `timeout` to the given value - /// This method configures the `timeout` field of `ServerTargetConfig`. - pub fn timeout(mut self, timeout: u64) -> Self { - self.timeout = timeout; - self - } - - /// Set `once` to the given value - /// This method configures the `once` field of `ServerTargetConfig`. - pub fn set_once(&mut self, enable: bool) { - self.once = enable; - } - - /// Set `timeout` to the given value - /// This method configures the `timeout` field of `ServerTargetConfig`. - pub fn set_timeout(&mut self, timeout: u64) { - self.timeout = timeout; - } - - /// Check if the server is configured to process only a single connection. - /// Returns `true` if the server will shut down after processing one connection. - pub fn is_once(&self) -> bool { - self.once - } - - /// Get the current timeout value in milliseconds. - /// Returns the timeout duration. A value of 0 indicates the connection is closed. - pub fn get_timeout(&self) -> u64 { - self.timeout - } -} - -#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize)] -pub struct ClientTargetConfig {} |
