Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use unitiaziled logger if proxy terminated #4

Open
wants to merge 1 commit into
base: v0.11-thevoid-0.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions debian/cocaine-native-proxy.init
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,19 @@ do_start()

ARGS=" -c $conf"
ulimit -n 65000; start-stop-daemon -S -p $PIDFILE -b -m -u $USER -d $CONFIG_DIR --exec $DAEMON -- $ARGS

if [ $? -ne 0 ];
then
if [ $? -ne 0 ]; then
echo "FAIL"
return 1
fi

pid=$(cat $PIDFILE 2>/dev/null)
echo -n ' ..... '
sleep 0.5
if kill -0 $pid 2>/dev/null
then
echo "OK"
else
echo "OK"
echo "FAIL"
fi
done
}
Expand Down
7 changes: 5 additions & 2 deletions proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,11 @@ proxy::initialize(const rapidjson::Value &config) {
}

proxy::~proxy() {
COCAINE_LOG_INFO(m_service_manager->get_system_logger(),
"Proxy will be stopped now.");
// in case of malformed config it could be uninitialized
if (m_service_manager) {
COCAINE_LOG_INFO(m_service_manager->get_system_logger(),
"Proxy will be stopped now.");
}

m_service_manager.reset();
}
Expand Down