Closed
Description
The node.js process should terminate exactly 1 second after a client connects. Instead, it takes 26 seconds.
Given this server:
io = require 'socket.io'
s = io.listen 4321
s.sockets.on 'connection', (socket) ->
console.log 'new connection'
console.log 'client connected. Server will close in 1 second...'
setTimeout (-> s.server.close()), 1000
... and this client:
io = require 'socket.io-client'
soon = (f) -> setTimeout f, 2000
client = io.connect 'http://localhost:4321'
client.on 'connect', ->
console.log 'connected'
soon ->
client.disconnect()
console.log 'disconnected'
.... this is what happens:
$ time coffee server.coffee
info - socket.io started
debug - client authorized
info - handshake authorized 21153209321339684377
debug - setting request GET /socket.io/1/websocket/21153209321339684377
debug - set heartbeat interval for client 21153209321339684377
debug - client authorized for
debug - websocket writing 1::
new connection
client connected. Server will close in 1 second...
debug - websocket received data packet 5:1+::{"name":"newListener","args":["connect"]}
debug - websocket received data packet 0::
debug - got disconnection packet
info - transport end by forced client disconnection
debug - websocket writing 0::
info - transport end
debug - set close timeout for client 21153209321339684377
debug - cleared close timeout for client 21153209321339684377
debug - cleared heartbeat interval for client 21153209321339684377
debug - discarding transport
real 0m26.230s
user 0m0.294s
sys 0m0.043s