Permalink
Browse files

bind vip.status to vip & use async close

  • Loading branch information...
q3boy committed Jan 21, 2013
1 parent cba7249 commit 67873802cd50cbce5f2bd1f4ce53e5a4a8943397
Showing with 24 additions and 16 deletions.
  1. +9 −5 lib/vip-resp.coffee
  2. +11 −7 out/release/lib/vip-resp.js
  3. +1 −1 package.json
  4. +1 −1 package.yaml
  5. +2 −2 tests/test-vip-resp.coffee
View
@@ -13,7 +13,7 @@ class VipStatus
success_body : 'success'
timeout : 2000
, options
- @status.bind @
+ @status = @status.bind @
@force = 'auto'
@net = null
@listen()
@@ -26,10 +26,14 @@ class VipStatus
@force = 'auto' if @force isnt 'on' and @force isnt 'off'
.listen @options.sock_path
- close : ->
- return if not @net
- @net.close()
- try fs.unlink @options.sock_path
+ close : (cb)->
+ return cb null if not @net
+ @net.close =>
+ if fs.existsSync @options.sock_path
+ fs.unlink @options.sock_path, cb
+ else
+ cb null
+ # try fs.unlinkSync @options.sock_path
response = (resp, code, phrase) ->
resp.setHeader 'Content-Type', 'text/plain'

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,7 +1,7 @@
{
"name": "vip-resp",
"main": "out/release/lib/nvsr.js",
- "version": "0.0.1",
+ "version": "0.0.2",
"description": "vip status check responser",
"author": {
"name": "q3boy",
View
@@ -1,6 +1,6 @@
name: vip-resp
main: out/release/lib/nvsr.js
-version: 0.0.1
+version: 0.0.2
description: vip status check responser
author:
name: q3boy
@@ -30,8 +30,8 @@ describe 'Node Vip StatusCode Responser', ->
s = null
flag = 0
mock.clean()
- afterEach ->
- s.close() if s
+ afterEach (done)->
+ s.close(done) if s and s.close
sock = __dirname + "/test-vr.sock"
options =
check_health: (cb)->

0 comments on commit 6787380

Please sign in to comment.