1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2025-01-09 00:20:08 +00:00

Optimize server.coffee even more

This commit is contained in:
Tim Düsterhus 2013-04-05 21:23:08 +02:00
parent 74c530db80
commit 98f99ed1a3

View File

@ -1,8 +1,8 @@
### ###
# node.js Pushserver for Tims Chat. # node.js Pushserver for Tims Chat.
# #
# @author Tim D<EFBFBD>sterhus # @author Tim Düsterhus
# @copyright 2010-2013 Tim D<EFBFBD>sterhus # @copyright 2010-2013 Tim Düsterhus
# @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> # @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
# @package be.bastelstu.chat # @package be.bastelstu.chat
# @subpackage nodePush # @subpackage nodePush
@ -20,9 +20,6 @@ log = (message) ->
class Server class Server
constructor: () -> constructor: () ->
if process.cwd().substring(process.cwd().length - 3) isnt 'lib'
console.error 'Please run me via bin/run.sh'
process.exit 1
log 'Starting Pushserver for Tims Chat' log 'Starting Pushserver for Tims Chat'
log "PID is #{process.pid}" log "PID is #{process.pid}"
log "Using port: #{config.port}" log "Using port: #{config.port}"
@ -60,13 +57,13 @@ class Server
c.end() c.end()
socket.listen process.cwd() + '/../data.sock' socket.listen "#{__dirname}/../data.sock"
fs.chmod process.cwd() + '/../data.sock', '777' fs.chmod "#{__dirname}/../data.sock", '777'
shutdown: () -> shutdown: () ->
return unless fs.existsSync process.cwd() + '/../data.sock' return unless fs.existsSync "#{__dirname}/../data.sock"
log 'Shutting down' log 'Shutting down'
fs.unlinkSync process.cwd() + '/../data.sock' fs.unlinkSync "#{__dirname}/../data.sock"
process.exit() process.exit()
new Server() new Server()