Skip to content

Commit 7d51e47

Browse files
committed
work on #46 (handle quit local consoles gracefully)
1 parent 2712d7e commit 7d51e47

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

phpdbg.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,18 +1243,25 @@ int main(int argc, char **argv) /* {{{ */
12431243
#ifndef _WIN32
12441244
/* remote client disconnected */
12451245
if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) {
1246-
1247-
/* renegociate connections */
1248-
phpdbg_open_sockets(
1249-
address, listen, &server, &socket, streams);
12501246

1251-
/* set streams */
1252-
if (streams[0] && streams[1]) {
1253-
PHPDBG_G(flags) &= ~PHPDBG_IS_QUITTING;
1247+
if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) {
1248+
/* renegociate connections */
1249+
phpdbg_open_sockets(
1250+
address, listen, &server, &socket, streams);
1251+
1252+
/* set streams */
1253+
if (streams[0] && streams[1]) {
1254+
PHPDBG_G(flags) &= ~PHPDBG_IS_QUITTING;
1255+
}
1256+
1257+
/* this must be forced */
1258+
CG(unclean_shutdown) = 0;
1259+
} else {
1260+
/* local client quit console */
1261+
CG(unclean_shutdown) = 0;
1262+
1263+
goto phpdbg_out;
12541264
}
1255-
1256-
/* this must be forced */
1257-
CG(unclean_shutdown) = 0;
12581265
}
12591266
#endif
12601267
if (PHPDBG_G(flags) & PHPDBG_IS_QUITTING) {

0 commit comments

Comments
 (0)