You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-08-10 22:41:43 +02:00
Пересборка TCP компоненты
This commit is contained in:
Binary file not shown.
@@ -48,7 +48,7 @@ pub fn receive(
|
||||
buffer_size: i32,
|
||||
timeout_ms: i32,
|
||||
max_data_size: i32,
|
||||
max_duration_ms: i32,
|
||||
max_duration_s: f64,
|
||||
) -> Vec<u8> {
|
||||
|
||||
let mut result = Vec::new();
|
||||
@@ -56,7 +56,7 @@ pub fn receive(
|
||||
let start_time = Instant::now();
|
||||
|
||||
// Если max_duration_ms > 0, устанавливаем таймаут только если он не установлен
|
||||
if max_duration_ms > 0 {
|
||||
if max_duration_s > 0.0 {
|
||||
match connection {
|
||||
Connection::Tcp(stream) => {
|
||||
stream.set_read_timeout(Some(Duration::from_millis(timeout_ms as u64))).ok();
|
||||
@@ -70,7 +70,7 @@ pub fn receive(
|
||||
loop {
|
||||
// Проверяем ограничения, если они заданы
|
||||
if (max_data_size > 0 && result.len() >= max_data_size as usize) ||
|
||||
(max_duration_ms > 0 && start_time.elapsed() > Duration::from_millis(max_duration_ms as u64)) {
|
||||
(max_duration_s > 0.0 && start_time.elapsed() > Duration::from_secs_f64(max_duration_s)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -44,7 +44,7 @@ pub fn cal_func(obj: &mut AddIn, num: usize, params: &mut [Variant]) -> Box<dyn
|
||||
let size = params[0].get_i32().unwrap_or(0);
|
||||
let timeout = params[1].get_i32().unwrap_or(0);
|
||||
let maxsize = params[2].get_i32().unwrap_or(0);
|
||||
let maxduration = params[3].get_i32().unwrap_or(0);
|
||||
let maxduration = params[3].get_f64().unwrap_or(0.0);
|
||||
|
||||
if let Some(ref mut connection) = obj.connection {
|
||||
Box::new(methods::receive(connection, size, timeout, maxsize, maxduration))
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -103,8 +103,6 @@
|
||||
OPI_ПреобразованиеТипов.ПолучитьЧисло(Таймаут);
|
||||
OPI_ПреобразованиеТипов.ПолучитьЧисло(Размер);
|
||||
|
||||
Таймаут = Таймаут * 1000;
|
||||
|
||||
Возврат Соединение.Read(1024, 150, Размер, Таймаут);
|
||||
|
||||
КонецФункции
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user