Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
more error checks
Browse files Browse the repository at this point in the history
  • Loading branch information
DenizUgur committed Jul 19, 2022
1 parent 9fa120f commit e0e4434
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ EXPOSE 80

# Install Node.js & NGINX
RUN apt-get update && \
apt-get install --no-install-recommends -y nginx figlet && \
apt-get install --no-install-recommends -y nginx figlet curl && \
rm -rf /var/lib/apt/lists/*

COPY --from=ffmpeg-builder /libraries/usr/lib /usr/lib/x86_64-linux-gnu/
Expand Down
11 changes: 10 additions & 1 deletion scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ nginx

# Start GPAC
cd /opt
(gpac-dash -chunk-media-segments -cors $NETWORK_PROFILE &) >/dev/null 2>&1
(gpac-dash -chunk-media-segments -cors $NETWORK_PROFILE &) 1>/dev/null

# Check if GPAC is running
sleep 1
curl -s http://localhost:8000/status | grep -q "OK"

if [ $? -ne 0 ]; then
echo "GPAC failed to launch, check your arguments"
exit 1
fi

# Show banner
figlet "A-CAPSC Demonstration"
Expand Down
6 changes: 6 additions & 0 deletions server/gpac-dash.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,12 @@ var onRequest = function (req, res) {
var notFound = false;
var fStat;

if (req.url == "/status") {
res.writeHead(200, { "Content-Type": "text/plain" });
res.end("OK");
return;
}

if (incoming_log_file && (req.url.slice(-3) === "mpd")) {
fs.appendFile(incoming_log_file, (new Date()) + ": Incoming request from " + req.socket.remoteAddress + " for URL: " + req.url + " with headers: " + JSON.stringify(req.headers) + "\n");
}
Expand Down

0 comments on commit e0e4434

Please sign in to comment.