Skip to content
Snippets Groups Projects
Commit ba7a4fee authored by Dmitry E. Oboukhov's avatar Dmitry E. Oboukhov
Browse files

Add tests for socket:close closes #360

parent e7b32856
No related branches found
No related tags found
No related merge requests found
...@@ -814,13 +814,39 @@ string.sub(s:read(128), 1, 9) ...@@ -814,13 +814,39 @@ string.sub(s:read(128), 1, 9)
--- ---
- Tarantool - Tarantool
... ...
-- sa = { fh = 512 } setmetatable(sa, getmetatable(s)) sa = { fh = 512 } setmetatable(sa, getmetatable(s))
-- tostring(sa) ---
-- sa:readable(0) ...
-- sa:writable(0) tostring(sa)
-- ch = fiber.channel() ---
-- f = fiber.wrap(function() s:read(12) ch:put(true) end) - fd 512
-- fiber.sleep(.1) ...
-- s:close() sa:readable(0)
-- ch:get(1) ---
-- s:error() - true
...
sa:writable(0)
---
- true
...
ch = fiber.channel()
---
...
f = fiber.wrap(function() s:read(12) ch:put(true) end)
---
...
fiber.sleep(.1)
---
...
s:close()
---
- true
...
ch:get(1)
---
- true
...
s:error()
---
- Connection timed out
...
...@@ -260,14 +260,14 @@ socket.tcp_connect('127.0.0.1', 80, 0.00000000001) ...@@ -260,14 +260,14 @@ socket.tcp_connect('127.0.0.1', 80, 0.00000000001)
s = socket.tcp_connect('127.0.0.1', primary_port) s = socket.tcp_connect('127.0.0.1', primary_port)
string.sub(s:read(128), 1, 9) string.sub(s:read(128), 1, 9)
-- sa = { fh = 512 } setmetatable(sa, getmetatable(s)) sa = { fh = 512 } setmetatable(sa, getmetatable(s))
-- tostring(sa) tostring(sa)
-- sa:readable(0) sa:readable(0)
-- sa:writable(0) sa:writable(0)
-- ch = fiber.channel() ch = fiber.channel()
-- f = fiber.wrap(function() s:read(12) ch:put(true) end) f = fiber.wrap(function() s:read(12) ch:put(true) end)
-- fiber.sleep(.1) fiber.sleep(.1)
-- s:close() s:close()
-- ch:get(1) ch:get(1)
-- s:error() s:error()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment