From 853a0d4dc9e9d10a025facf0d25159ba0436ea0f Mon Sep 17 00:00:00 2001 From: RadKesvat Date: Fri, 22 Dec 2023 23:15:22 +0330 Subject: [PATCH] test --- src/foreign_server.nim | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/foreign_server.nim b/src/foreign_server.nim index 8ca0dd4..26ea7b1 100644 --- a/src/foreign_server.nim +++ b/src/foreign_server.nim @@ -147,15 +147,7 @@ proc processConnection(client: Connection) {.async.} = if client.isClosing: # await client.twriter.finish() client = await acquireClientConnection(true) - - var len = 3000+rand(globals.random_str.len() - 3000) - let random_start = rand(1500) - let full_len = min((len+random_start), globals.random_str.len() - random_start) - var data = globals.random_str[random_start ..< full_len] - let flag: TransferFlags = {DataFlags.junk} - data.flagForSend(flag) - discard client.twriter.write(data) - + if client == nil: if globals.log_conn_error: echo "[Error] [processRemote] [loop]: ", "no client for tcp !" break @@ -336,16 +328,17 @@ proc poolController() {.async.} = await conn.twriter.write(generateFinishHandShakeData(upload)) - # await sleepAsync(3500) - # if upload: - # block initialWriteToOpenBandWidth: - # var len = 3000+rand(globals.random_str.len() - 3000) - # let random_start = rand(1500) - # let full_len = min((len+random_start), globals.random_str.len() - random_start) - # var data = globals.random_str[random_start ..< full_len] - # let flag: TransferFlags = {DataFlags.junk} - # data.flagForSend(flag) - # await conn.twriter.write(data) + await sleepAsync(3500) + if upload: + block initialWriteToOpenBandWidth: + for i in 0..10: + var len = 3000+rand(globals.random_str.len() - 3000) + let random_start = rand(1500) + let full_len = min((len+random_start), globals.random_str.len() - random_start) + var data = globals.random_str[random_start ..< full_len] + let flag: TransferFlags = {DataFlags.junk} + data.flagForSend(flag) + await conn.twriter.write(data) if upload: context.up_bounds.add conn