--- libaitio/src/sock.c 2013/12/12 21:17:53 1.11.2.3 +++ libaitio/src/sock.c 2013/12/15 22:31:44 1.11.2.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: sock.c,v 1.11.2.3 2013/12/12 21:17:53 misho Exp $ +* $Id: sock.c,v 1.11.2.6 2013/12/15 22:31:44 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -63,7 +63,11 @@ io_closeClient(sched_task_t *task) ioFreePTY(cli->cli_pty, cli->cli_name); if (s->sock_prog) { io_progDetach(s->sock_prog, cli->cli_pty); +#if 0 + io_progCloseAt(s->sock_prog, cli->cli_pty); +#endif cli->cli_pty ^= cli->cli_pty; + io_progCheck(s->sock_prog, 42); } if (s->sock_type == SOCK_STREAM) { @@ -153,8 +157,10 @@ io_txNet(sched_task_t *task) if ((ret = poll(pfd, 1, s->sock_timeout.tv_sec * 1000)) < 1 || pfd->revents & (POLLNVAL | POLLERR | POLLHUP)) { +#if 0 if (!ret) continue; +#endif schedEvent(TASK_ROOT(task), io_closeClient, cli, 0, NULL, 0); break; } @@ -352,6 +358,8 @@ io_bridgeClient2Pool(sched_task_t *task) pthread_mutex_unlock(&s->sock_mtx); } + io_progCheck(s->sock_prog, 42); + cli->cli_parent = TASK_ARG(task); cli->cli_fd = c; cli->cli_pty = io_progAttach(s->sock_prog, 42); @@ -630,8 +638,12 @@ ioBridgeProg2Socket(sock_t * __restrict s, const char if (!s || !prgname || s->sock_kill) return -1; - schedRead(s->sock_root, s->sock_prog ? io_bridgeClient2Pool : io_bridgeClient, - s, s->sock_fd, (void*) prgname, 0); + if (s->sock_prog) + schedRead(s->sock_root, io_bridgeClient2Pool, + s, s->sock_fd, (void*) prgname, 0); + else + schedRead(s->sock_root, io_bridgeClient, + s, s->sock_fd, (void*) prgname, 0); return schedRun(s->sock_root, &s->sock_kill); }