daemon:on(aux._EVE_ERROR, function(e)
ret = aux._EXIT_FAILURE
if (e == aux._ERR_EADDRINUSE) then
print(daemon_name .. aux._ERR_CANNOT_START_SERVER
.. aux._ERR_SRV_PORT_IS_IN_USE
.. aux._NEW_LINE)
else
print(daemon_name .. aux._ERR_CANNOT_START_SERVER
.. aux._ERR_SRV_UNKNOWN_REASON
.. aux._NEW_LINE)
end
_cleanups_fixate()
return ret
end)
daemon:on(aux._EVE_LISTENING, function(e)
print(aux._MSG_SERVER_STARTED_1 .. port_number .. aux._NEW_LINE
.. aux._MSG_SERVER_STARTED_2)
end)
pp.prettyPrint(daemon)
-- FIXME: Investigate why do we need emitting events explicitly?
-- This does not affect error events anyway, perplexedly.
daemon:emit(aux._EVE_LISTENING )
-- daemon:emit(aux._EVE_ERROR, aux._ERR_EADDRINUSE)
-- daemon:emit(aux._EVE_ERROR )