Skip to content

Commit 40d55a5

Browse files
committed
✨ Signal ready/EADDRINUSE to a Java Hohenheim parent over the TCP IPC bridge
1 parent 636ac60 commit 40d55a5

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

lib/stages/90-server.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ const start = server.createStage('start', () => {
290290
log.info('Served at »»', pretty_url, '««');
291291
}
292292

293-
// If this process is a child, tell the parent we're ready
293+
// If this process is a child, tell the parent we're ready.
294+
// Under the Java Hohenheim there is no Node IPC channel: readiness
295+
// travels over the HOHENHEIM_IPC_PORT TCP socket as flat JSON instead.
294296
if (process.send) {
295297
log.info('Letting the parent know we\'re ready!');
296298
process.send({alchemy: {ready: true}});
@@ -299,6 +301,9 @@ const start = server.createStage('start', () => {
299301
log.info('Parent exited, closing down');
300302
process.exit();
301303
});
304+
} else if (alchemy.hohenheim_ipc_socket) {
305+
log.info('Letting the Hohenheim parent know we\'re ready (TCP IPC)!');
306+
alchemy.hohenheim_ipc_socket.write(JSON.stringify({type: 'ready'}) + '\n');
302307
}
303308

304309
server.launch(true);
@@ -312,6 +317,11 @@ const start = server.createStage('start', () => {
312317
return process.exit();
313318
}
314319

320+
if (alchemy.hohenheim_ipc_socket) {
321+
alchemy.hohenheim_ipc_socket.write(JSON.stringify({type: 'error', code: err && err.code}) + '\n');
322+
return process.exit();
323+
}
324+
315325
throw err;
316326
});
317327
});

0 commit comments

Comments
 (0)