60 |
extern DEVICE_FNS parallel_fns; |
extern DEVICE_FNS parallel_fns; |
61 |
extern DEVICE_FNS disk_fns; |
extern DEVICE_FNS disk_fns; |
62 |
extern FILEINFO g_fileinfo[]; |
extern FILEINFO g_fileinfo[]; |
63 |
|
|
64 |
static VCHANNEL *rdpdr_channel; |
static VCHANNEL *rdpdr_channel; |
65 |
|
|
66 |
/* If select() times out, the request for the device with handle g_min_timeout_fd is aborted */ |
/* If select() times out, the request for the device with handle g_min_timeout_fd is aborted */ |
814 |
iorq = g_iorequest; |
iorq = g_iorequest; |
815 |
while (iorq != NULL) |
while (iorq != NULL) |
816 |
{ |
{ |
817 |
/* We need to test that the fd is still valid */ |
if (iorq->fd != 0) |
|
if ((iorq->fd != 0) && (read(iorq->fd, &c, 0) == 0)) |
|
818 |
{ |
{ |
819 |
switch (iorq->major) |
switch (iorq->major) |
820 |
{ |
{ |
821 |
case IRP_MJ_READ: |
case IRP_MJ_READ: |
822 |
|
/* Is this FD valid? FDs will |
823 |
|
be invalid when |
824 |
|
reconnecting. FIXME: Real |
825 |
|
support for reconnects. */ |
826 |
|
|
827 |
|
if (read(iorq->fd, &c, 0) != 0) |
828 |
|
break; |
829 |
|
|
830 |
FD_SET(iorq->fd, rfds); |
FD_SET(iorq->fd, rfds); |
831 |
|
*n = MAX(*n, iorq->fd); |
832 |
|
|
833 |
// Check if io request timeout is smaller than current (but not 0). |
// Check if io request timeout is smaller than current (but not 0). |
834 |
if (iorq->timeout |
if (iorq->timeout |
842 |
tv->tv_usec = (select_timeout % 1000) * 1000; |
tv->tv_usec = (select_timeout % 1000) * 1000; |
843 |
*timeout = True; |
*timeout = True; |
844 |
} |
} |
845 |
|
|
846 |
break; |
break; |
847 |
|
|
848 |
case IRP_MJ_WRITE: |
case IRP_MJ_WRITE: |
849 |
|
/* FD still valid? See above. */ |
850 |
|
if (write(iorq->fd, &c, 0) != 0) |
851 |
|
break; |
852 |
|
|
853 |
FD_SET(iorq->fd, wfds); |
FD_SET(iorq->fd, wfds); |
854 |
|
*n = MAX(*n, iorq->fd); |
855 |
break; |
break; |
856 |
|
|
857 |
} |
} |
858 |
*n = MAX(*n, iorq->fd); |
|
859 |
} |
} |
860 |
|
|
861 |
iorq = iorq->next; |
iorq = iorq->next; |