Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
RadKesvat committed Dec 22, 2023
1 parent 7c46145 commit 853a0d4
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions src/foreign_server.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 853a0d4

Please sign in to comment.