82 |
/* Add a new io request to the table containing pending io requests so it won't block rdesktop */ |
/* Add a new io request to the table containing pending io requests so it won't block rdesktop */ |
83 |
BOOL |
BOOL |
84 |
add_async_iorequest(uint32 device, uint32 file, uint32 id, uint32 major, uint32 length, |
add_async_iorequest(uint32 device, uint32 file, uint32 id, uint32 major, uint32 length, |
85 |
DEVICE_FNS * fns, uint32 total_timeout, uint32 interval_timeout, uint8 * buffer) |
DEVICE_FNS * fns, uint32 total_timeout, uint32 interval_timeout, uint8 * buffer, |
86 |
|
uint32 offset) |
87 |
{ |
{ |
88 |
struct async_iorequest *iorq; |
struct async_iorequest *iorq; |
89 |
|
|
122 |
iorq->timeout = total_timeout; |
iorq->timeout = total_timeout; |
123 |
iorq->itv_timeout = interval_timeout; |
iorq->itv_timeout = interval_timeout; |
124 |
iorq->buffer = buffer; |
iorq->buffer = buffer; |
125 |
|
iorq->offset = offset; |
126 |
return True; |
return True; |
127 |
} |
} |
128 |
|
|
414 |
serial_get_timeout(file, length, &total_timeout, &interval_timeout); |
serial_get_timeout(file, length, &total_timeout, &interval_timeout); |
415 |
if (add_async_iorequest |
if (add_async_iorequest |
416 |
(device, file, id, major, length, fns, total_timeout, interval_timeout, |
(device, file, id, major, length, fns, total_timeout, interval_timeout, |
417 |
pst_buf)) |
pst_buf, offset)) |
418 |
{ |
{ |
419 |
status = STATUS_PENDING; |
status = STATUS_PENDING; |
420 |
break; |
break; |
455 |
in_uint8a(s, pst_buf, length); |
in_uint8a(s, pst_buf, length); |
456 |
|
|
457 |
if (add_async_iorequest |
if (add_async_iorequest |
458 |
(device, file, id, major, length, fns, 0, 0, pst_buf)) |
(device, file, id, major, length, fns, 0, 0, pst_buf, offset)) |
459 |
{ |
{ |
460 |
status = STATUS_PENDING; |
status = STATUS_PENDING; |
461 |
break; |
break; |
796 |
/* never read larger chunks than 8k - chances are that it will block */ |
/* never read larger chunks than 8k - chances are that it will block */ |
797 |
status = fns->read(iorq->fd, |
status = fns->read(iorq->fd, |
798 |
iorq->buffer + iorq->partial_len, |
iorq->buffer + iorq->partial_len, |
799 |
req_size, 0, &result); |
req_size, iorq->offset, &result); |
800 |
iorq->partial_len += result; |
iorq->partial_len += result; |
801 |
|
iorq->offset += result; |
802 |
|
|
803 |
#if WITH_DEBUG_RDP5 |
#if WITH_DEBUG_RDP5 |
804 |
DEBUG(("RDPDR: %d bytes of data read\n", result)); |
DEBUG(("RDPDR: %d bytes of data read\n", result)); |
824 |
{ |
{ |
825 |
prev->next = iorq->next; |
prev->next = iorq->next; |
826 |
xfree(iorq); |
xfree(iorq); |
827 |
|
iorq = prev->next; |
828 |
} |
} |
829 |
else |
else |
830 |
{ |
{ |
831 |
// Even if NULL |
// Even if NULL |
832 |
g_iorequest = iorq->next; |
g_iorequest = iorq->next; |
833 |
xfree(iorq); |
xfree(iorq); |
834 |
|
iorq = NULL; |
835 |
} |
} |
836 |
} |
} |
837 |
} |
} |
850 |
/* never write larger chunks than 8k - chances are that it will block */ |
/* never write larger chunks than 8k - chances are that it will block */ |
851 |
status = fns->write(iorq->fd, |
status = fns->write(iorq->fd, |
852 |
iorq->buffer + |
iorq->buffer + |
853 |
iorq->partial_len, req_size, 0, |
iorq->partial_len, req_size, |
854 |
&result); |
iorq->offset, &result); |
855 |
iorq->partial_len += result; |
iorq->partial_len += result; |
856 |
|
iorq->offset += result; |
857 |
#if WITH_DEBUG_RDP5 |
#if WITH_DEBUG_RDP5 |
858 |
DEBUG(("RDPDR: %d bytes of data written\n", |
DEBUG(("RDPDR: %d bytes of data written\n", |
859 |
result)); |
result)); |
879 |
{ |
{ |
880 |
prev->next = iorq->next; |
prev->next = iorq->next; |
881 |
xfree(iorq); |
xfree(iorq); |
882 |
|
iorq = prev->next; |
883 |
} |
} |
884 |
else |
else |
885 |
{ |
{ |
886 |
// Even if NULL |
// Even if NULL |
887 |
g_iorequest = iorq->next; |
g_iorequest = iorq->next; |
888 |
xfree(iorq); |
xfree(iorq); |
889 |
|
iorq = NULL; |
890 |
} |
} |
891 |
} |
} |
892 |
} |
} |
895 |
|
|
896 |
} |
} |
897 |
prev = iorq; |
prev = iorq; |
898 |
iorq = iorq->next; |
if (iorq) |
899 |
|
iorq = iorq->next; |
900 |
} |
} |
901 |
|
|
902 |
} |
} |