Investigation of Linux freezes #1.
This commit is contained in:
parent
ac8b11d6ca
commit
bb176ba574
|
@ -625,37 +625,58 @@ suite "TLSStream test suite":
|
||||||
|
|
||||||
proc serveClient(server: StreamServer,
|
proc serveClient(server: StreamServer,
|
||||||
transp: StreamTransport) {.async.} =
|
transp: StreamTransport) {.async.} =
|
||||||
|
echo "server accepted client"
|
||||||
var reader = newAsyncStreamReader(transp)
|
var reader = newAsyncStreamReader(transp)
|
||||||
var writer = newAsyncStreamWriter(transp)
|
var writer = newAsyncStreamWriter(transp)
|
||||||
var sstream = newTLSServerAsyncStream(reader, writer, key, cert)
|
var sstream = newTLSServerAsyncStream(reader, writer, key, cert)
|
||||||
|
echo "server handshaking"
|
||||||
await handshake(sstream)
|
await handshake(sstream)
|
||||||
|
echo "server handshaked"
|
||||||
await sstream.writer.write(testMessage & "\r\n")
|
await sstream.writer.write(testMessage & "\r\n")
|
||||||
|
echo "server wrote string"
|
||||||
await sstream.writer.closeWait()
|
await sstream.writer.closeWait()
|
||||||
|
echo "server closed secure writer"
|
||||||
await sstream.reader.closeWait()
|
await sstream.reader.closeWait()
|
||||||
|
echo "server closed secure reader"
|
||||||
await reader.closeWait()
|
await reader.closeWait()
|
||||||
|
echo "server closed reader"
|
||||||
await writer.closeWait()
|
await writer.closeWait()
|
||||||
|
echo "server closed writer"
|
||||||
await transp.closeWait()
|
await transp.closeWait()
|
||||||
|
echo "server closed transport"
|
||||||
server.stop()
|
server.stop()
|
||||||
|
echo "server stopped server"
|
||||||
server.close()
|
server.close()
|
||||||
|
echo "server closed server"
|
||||||
|
|
||||||
key = TLSPrivateKey.init(pemkey)
|
key = TLSPrivateKey.init(pemkey)
|
||||||
cert = TLSCertificate.init(pemcert)
|
cert = TLSCertificate.init(pemcert)
|
||||||
|
|
||||||
var server = createStreamServer(address, serveClient, {ReuseAddr})
|
var server = createStreamServer(address, serveClient, {ReuseAddr})
|
||||||
server.start()
|
server.start()
|
||||||
|
echo "server started"
|
||||||
var conn = await connect(address)
|
var conn = await connect(address)
|
||||||
|
echo "client connected"
|
||||||
var creader = newAsyncStreamReader(conn)
|
var creader = newAsyncStreamReader(conn)
|
||||||
var cwriter = newAsyncStreamWriter(conn)
|
var cwriter = newAsyncStreamWriter(conn)
|
||||||
# We are using self-signed certificate
|
# We are using self-signed certificate
|
||||||
let flags = {NoVerifyHost, NoVerifyServerName}
|
let flags = {NoVerifyHost, NoVerifyServerName}
|
||||||
var cstream = newTLSClientAsyncStream(creader, cwriter, "", flags = flags)
|
var cstream = newTLSClientAsyncStream(creader, cwriter, "", flags = flags)
|
||||||
|
echo "client reading line"
|
||||||
let res = await cstream.reader.readLine()
|
let res = await cstream.reader.readLine()
|
||||||
|
echo "client readed line"
|
||||||
await cstream.reader.closeWait()
|
await cstream.reader.closeWait()
|
||||||
|
echo "client closed reader"
|
||||||
await cstream.writer.closeWait()
|
await cstream.writer.closeWait()
|
||||||
|
echo "client closed writer"
|
||||||
await creader.closeWait()
|
await creader.closeWait()
|
||||||
|
echo "client closed creader"
|
||||||
await cwriter.closeWait()
|
await cwriter.closeWait()
|
||||||
|
echo "client closed cwriter"
|
||||||
await conn.closeWait()
|
await conn.closeWait()
|
||||||
|
echo "client closed connection"
|
||||||
await server.join()
|
await server.join()
|
||||||
|
echo "client waited server"
|
||||||
result = res == testMessage
|
result = res == testMessage
|
||||||
|
|
||||||
test "Simple server with RSA self-signed certificate":
|
test "Simple server with RSA self-signed certificate":
|
||||||
|
|
Loading…
Reference in New Issue