/[rdesktop]/sourceforge.net/trunk/rdesktop/rdpdr.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/rdpdr.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 593 by n-ki, Mon Feb 2 07:06:55 2004 UTC revision 595 by n-ki, Tue Feb 3 14:02:59 2004 UTC
# Line 317  rdpdr_process_irp(STREAM s) Line 317  rdpdr_process_irp(STREAM s)
317                  case DEVICE_TYPE_DISK:                  case DEVICE_TYPE_DISK:
318    
319                          fns = &disk_fns;                          fns = &disk_fns;
320                          /*rw_blocking = False; */                          rw_blocking = False;
321                          break;                          break;
322    
323                  case DEVICE_TYPE_SCARD:                  case DEVICE_TYPE_SCARD:
# Line 736  rdpdr_check_fds(fd_set * rfds, fd_set * Line 736  rdpdr_check_fds(fd_set * rfds, fd_set *
736          DEVICE_FNS *fns;          DEVICE_FNS *fns;
737          struct async_iorequest *iorq;          struct async_iorequest *iorq;
738          struct async_iorequest *prev;          struct async_iorequest *prev;
739            uint32 req_size = 0;
740    
741          if (timed_out)          if (timed_out)
742          {          {
# Line 747  rdpdr_check_fds(fd_set * rfds, fd_set * Line 748  rdpdr_check_fds(fd_set * rfds, fd_set *
748          prev = NULL;          prev = NULL;
749          while (iorq != NULL)          while (iorq != NULL)
750          {          {
   
751                  if (iorq->fd != 0)                  if (iorq->fd != 0)
752                  {                  {
753                          switch (iorq->major)                          switch (iorq->major)
# Line 758  rdpdr_check_fds(fd_set * rfds, fd_set * Line 758  rdpdr_check_fds(fd_set * rfds, fd_set *
758                                                  /* Read the data */                                                  /* Read the data */
759                                                  fns = iorq->fns;                                                  fns = iorq->fns;
760    
761                                                    req_size =
762                                                            (iorq->length - iorq->partial_len) >
763                                                            8192 ? 8192 : (iorq->length -
764                                                                           iorq->partial_len);
765                                                  /* never read larger chunks than 8k - chances are that it will block */                                                  /* never read larger chunks than 8k - chances are that it will block */
766                                                  status = fns->read(iorq->fd,                                                  status = fns->read(iorq->fd,
767                                                                     iorq->buffer + iorq->partial_len,                                                                     iorq->buffer + iorq->partial_len,
768                                                                     (iorq->length -                                                                     req_size, 0, &result);
                                                                     iorq->partial_len) >  
                                                                    8192 ? 8192 : (iorq->length -  
                                                                                   iorq->  
                                                                                   partial_len), 0,  
                                                                    &result);  
769                                                  iorq->partial_len += result;                                                  iorq->partial_len += result;
770    
771  #if WITH_DEBUG_RDP5  #if WITH_DEBUG_RDP5
772                                                  DEBUG(("RDPDR: %d bytes of data read\n", result));                                                  DEBUG(("RDPDR: %d bytes of data read\n", result));
773  #endif  #endif
774                                                  /* only delete link if all data has been transfered */                                                  /* only delete link if all data has been transfered */
775                                                  if (iorq->partial_len == iorq->length)                                                  /* or if result was 0 and status success - EOF      */
776                                                    if ((iorq->partial_len == iorq->length) ||
777                                                        (result == 0))
778                                                  {                                                  {
779    #if WITH_DEBUG_RDP5
780                                                            DEBUG(("RDPDR: AIO total %u bytes read of %u\n", iorq->partial_len, iorq->length));
781    #endif
782                                                          /* send the data */                                                          /* send the data */
783                                                          status = STATUS_SUCCESS;                                                          status = STATUS_SUCCESS;
784                                                          rdpdr_send_completion(iorq->device,                                                          rdpdr_send_completion(iorq->device,
785                                                                                iorq->id, status,                                                                                iorq->id, status,
786                                                                                iorq->length,                                                                                iorq->partial_len,
787                                                                                iorq->buffer, result);                                                                                iorq->buffer,
788                                                                                  iorq->partial_len);
789                                                          xfree(iorq->buffer);                                                          xfree(iorq->buffer);
790                                                          iorq->fd = 0;                                                          iorq->fd = 0;
791                                                          if (prev != NULL)                                                          if (prev != NULL)
# Line 803  rdpdr_check_fds(fd_set * rfds, fd_set * Line 808  rdpdr_check_fds(fd_set * rfds, fd_set *
808                                                  /* Write data. */                                                  /* Write data. */
809                                                  fns = iorq->fns;                                                  fns = iorq->fns;
810    
811                                                    req_size =
812                                                            (iorq->length - iorq->partial_len) >
813                                                            8192 ? 8192 : (iorq->length -
814                                                                           iorq->partial_len);
815    
816                                                  /* never write larger chunks than 8k - chances are that it will block */                                                  /* never write larger chunks than 8k - chances are that it will block */
817                                                  status = fns->write(iorq->fd,                                                  status = fns->write(iorq->fd,
818                                                                      iorq->buffer +                                                                      iorq->buffer +
819                                                                      iorq->partial_len,                                                                      iorq->partial_len, req_size, 0,
                                                                     (iorq->length -  
                                                                      iorq->partial_len) >  
                                                                     8192 ? 8192 : (iorq->length -  
                                                                                    iorq->  
                                                                                    partial_len), 0,  
820                                                                      &result);                                                                      &result);
821                                                  iorq->partial_len += result;                                                  iorq->partial_len += result;
822  #if WITH_DEBUG_RDP5  #if WITH_DEBUG_RDP5
# Line 819  rdpdr_check_fds(fd_set * rfds, fd_set * Line 824  rdpdr_check_fds(fd_set * rfds, fd_set *
824                                                         result));                                                         result));
825  #endif  #endif
826                                                  /* only delete link if all data has been transfered */                                                  /* only delete link if all data has been transfered */
827                                                  if (iorq->partial_len == iorq->length)                                                  /* or we couldn't write */
828                                                    if ((iorq->partial_len == iorq->length)
829                                                        || (result == 0))
830                                                  {                                                  {
831    #if WITH_DEBUG_RDP5
832                                                            DEBUG(("RDPDR: AIO total %u bytes written of %u\n", iorq->partial_len, iorq->length));
833    #endif
834                                                          /* send a status success */                                                          /* send a status success */
835                                                          status = STATUS_SUCCESS;                                                          status = STATUS_SUCCESS;
836                                                          rdpdr_send_completion(iorq->device,                                                          rdpdr_send_completion(iorq->device,
837                                                                                iorq->id, status,                                                                                iorq->id, status,
838                                                                                iorq->length, "", 1);                                                                                iorq->partial_len, "",
839                                                                                  1);
840    
841                                                          xfree(iorq->buffer);                                                          xfree(iorq->buffer);
842                                                          iorq->fd = 0;                                                          iorq->fd = 0;

Legend:
Removed from v.593  
changed lines
  Added in v.595

  ViewVC Help
Powered by ViewVC 1.1.26