Index: pbx/pbx_dundi.c =================================================================== --- pbx/pbx_dundi.c (revision 386686) +++ pbx/pbx_dundi.c (working copy) @@ -2162,7 +2162,7 @@ from the network, and queue them for delivery to the channels */ int res; /* Establish I/O callback for socket read */ - ast_io_add(io, netsocket, socket_read, AST_IO_IN, NULL); + int *socket_read_id = ast_io_add(io, netsocket, socket_read, AST_IO_IN, NULL); while (!dundi_shutdown) { res = ast_sched_wait(sched); @@ -2177,6 +2177,7 @@ check_password(); } + ast_io_remove(io, socket_read_id); netthreadid = AST_PTHREADT_NULL; return NULL;