diff options
Diffstat (limited to 'benchmark/net/tcp-raw-s2c.js')
-rw-r--r-- | benchmark/net/tcp-raw-s2c.js | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/benchmark/net/tcp-raw-s2c.js b/benchmark/net/tcp-raw-s2c.js index 2ca6016ce0..339f5e393d 100644 --- a/benchmark/net/tcp-raw-s2c.js +++ b/benchmark/net/tcp-raw-s2c.js @@ -19,22 +19,7 @@ const TCPConnectWrap = process.binding('tcp_wrap').TCPConnectWrap; const WriteWrap = process.binding('stream_wrap').WriteWrap; const PORT = common.PORT; -var dur; -var len; -var type; - -function main(conf) { - dur = +conf.dur; - len = +conf.len; - type = conf.type; - server(); -} - -function fail(err, syscall) { - throw util._errnoException(err, syscall); -} - -function server() { +function main({ dur, len, type }) { const serverHandle = new TCP(TCPConstants.SERVER); var err = serverHandle.bind('127.0.0.1', PORT); if (err) @@ -103,10 +88,14 @@ function server() { } }; - client(); + client(dur); +} + +function fail(err, syscall) { + throw util._errnoException(err, syscall); } -function client() { +function client(dur) { const clientHandle = new TCP(TCPConstants.SOCKET); const connectReq = new TCPConnectWrap(); const err = clientHandle.connect(connectReq, '127.0.0.1', PORT); |