/[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 602 by stargo, Sat Feb 7 17:32:21 2004 UTC
# Line 220  rdpdr_send_available(void) Line 220  rdpdr_send_available(void)
220                                  rdp_out_unistr(s, printerinfo->printer, printerlen - 2);                                  rdp_out_unistr(s, printerinfo->printer, printerlen - 2);
221                                  out_uint8a(s, printerinfo->blob, bloblen);                                  out_uint8a(s, printerinfo->blob, bloblen);
222    
223                                  xfree(printerinfo->blob);       /* Blob is sent twice if reconnecting */                                  if (printerinfo->blob)
224                                            xfree(printerinfo->blob);       /* Blob is sent twice if reconnecting */
225                                  break;                                  break;
226                          default:                          default:
227                                  out_uint32(s, 0);                                  out_uint32(s, 0);
# Line 317  rdpdr_process_irp(STREAM s) Line 318  rdpdr_process_irp(STREAM s)
318                  case DEVICE_TYPE_DISK:                  case DEVICE_TYPE_DISK:
319    
320                          fns = &disk_fns;                          fns = &disk_fns;
321                          /*rw_blocking = False; */                          rw_blocking = False;
322                          break;                          break;
323    
324                  case DEVICE_TYPE_SCARD:                  case DEVICE_TYPE_SCARD:
# Line 736  rdpdr_check_fds(fd_set * rfds, fd_set * Line 737  rdpdr_check_fds(fd_set * rfds, fd_set *
737          DEVICE_FNS *fns;          DEVICE_FNS *fns;
738          struct async_iorequest *iorq;          struct async_iorequest *iorq;
739          struct async_iorequest *prev;          struct async_iorequest *prev;
740            uint32 req_size = 0;
741    
742          if (timed_out)          if (timed_out)
743          {          {
# Line 747  rdpdr_check_fds(fd_set * rfds, fd_set * Line 749  rdpdr_check_fds(fd_set * rfds, fd_set *
749          prev = NULL;          prev = NULL;
750          while (iorq != NULL)          while (iorq != NULL)
751          {          {
   
752                  if (iorq->fd != 0)                  if (iorq->fd != 0)
753                  {                  {
754                          switch (iorq->major)                          switch (iorq->major)
# Line 758  rdpdr_check_fds(fd_set * rfds, fd_set * Line 759  rdpdr_check_fds(fd_set * rfds, fd_set *
759                                                  /* Read the data */                                                  /* Read the data */
760                                                  fns = iorq->fns;                                                  fns = iorq->fns;
761    
762                                                    req_size =
763                                                            (iorq->length - iorq->partial_len) >
764                                                            8192 ? 8192 : (iorq->length -
765                                                                           iorq->partial_len);
766                                                  /* never read larger chunks than 8k - chances are that it will block */                                                  /* never read larger chunks than 8k - chances are that it will block */
767                                                  status = fns->read(iorq->fd,                                                  status = fns->read(iorq->fd,
768                                                                     iorq->buffer + iorq->partial_len,                                                                     iorq->buffer + iorq->partial_len,
769                                                                     (iorq->length -                                                                     req_size, 0, &result);
                                                                     iorq->partial_len) >  
                                                                    8192 ? 8192 : (iorq->length -  
                                                                                   iorq->  
                                                                                   partial_len), 0,  
                                                                    &result);  
770                                                  iorq->partial_len += result;                                                  iorq->partial_len += result;
771    
772  #if WITH_DEBUG_RDP5  #if WITH_DEBUG_RDP5
773                                                  DEBUG(("RDPDR: %d bytes of data read\n", result));                                                  DEBUG(("RDPDR: %d bytes of data read\n", result));
774  #endif  #endif
775                                                  /* only delete link if all data has been transfered */                                                  /* only delete link if all data has been transfered */
776                                                  if (iorq->partial_len == iorq->length)                                                  /* or if result was 0 and status success - EOF      */
777                                                    if ((iorq->partial_len == iorq->length) ||
778                                                        (result == 0))
779                                                  {                                                  {
780    #if WITH_DEBUG_RDP5
781                                                            DEBUG(("RDPDR: AIO total %u bytes read of %u\n", iorq->partial_len, iorq->length));
782    #endif
783                                                          /* send the data */                                                          /* send the data */
784                                                          status = STATUS_SUCCESS;                                                          status = STATUS_SUCCESS;
785                                                          rdpdr_send_completion(iorq->device,                                                          rdpdr_send_completion(iorq->device,
786                                                                                iorq->id, status,                                                                                iorq->id, status,
787                                                                                iorq->length,                                                                                iorq->partial_len,
788                                                                                iorq->buffer, result);                                                                                iorq->buffer,
789                                                                                  iorq->partial_len);
790                                                          xfree(iorq->buffer);                                                          xfree(iorq->buffer);
791                                                          iorq->fd = 0;                                                          iorq->fd = 0;
792                                                          if (prev != NULL)                                                          if (prev != NULL)
# Line 803  rdpdr_check_fds(fd_set * rfds, fd_set * Line 809  rdpdr_check_fds(fd_set * rfds, fd_set *
809                                                  /* Write data. */                                                  /* Write data. */
810                                                  fns = iorq->fns;                                                  fns = iorq->fns;
811    
812                                                    req_size =
813                                                            (iorq->length - iorq->partial_len) >
814                                                            8192 ? 8192 : (iorq->length -
815                                                                           iorq->partial_len);
816    
817                                                  /* never write larger chunks than 8k - chances are that it will block */                                                  /* never write larger chunks than 8k - chances are that it will block */
818                                                  status = fns->write(iorq->fd,                                                  status = fns->write(iorq->fd,
819                                                                      iorq->buffer +                                                                      iorq->buffer +
820                                                                      iorq->partial_len,                                                                      iorq->partial_len, req_size, 0,
                                                                     (iorq->length -  
                                                                      iorq->partial_len) >  
                                                                     8192 ? 8192 : (iorq->length -  
                                                                                    iorq->  
                                                                                    partial_len), 0,  
821                                                                      &result);                                                                      &result);
822                                                  iorq->partial_len += result;                                                  iorq->partial_len += result;
823  #if WITH_DEBUG_RDP5  #if WITH_DEBUG_RDP5
# Line 819  rdpdr_check_fds(fd_set * rfds, fd_set * Line 825  rdpdr_check_fds(fd_set * rfds, fd_set *
825                                                         result));                                                         result));
826  #endif  #endif
827                                                  /* only delete link if all data has been transfered */                                                  /* only delete link if all data has been transfered */
828                                                  if (iorq->partial_len == iorq->length)                                                  /* or we couldn't write */
829                                                    if ((iorq->partial_len == iorq->length)
830                                                        || (result == 0))
831                                                  {                                                  {
832    #if WITH_DEBUG_RDP5
833                                                            DEBUG(("RDPDR: AIO total %u bytes written of %u\n", iorq->partial_len, iorq->length));
834    #endif
835                                                          /* send a status success */                                                          /* send a status success */
836                                                          status = STATUS_SUCCESS;                                                          status = STATUS_SUCCESS;
837                                                          rdpdr_send_completion(iorq->device,                                                          rdpdr_send_completion(iorq->device,
838                                                                                iorq->id, status,                                                                                iorq->id, status,
839                                                                                iorq->length, "", 1);                                                                                iorq->partial_len, (uint8*)"",
840                                                                                  1);
841    
842                                                          xfree(iorq->buffer);                                                          xfree(iorq->buffer);
843                                                          iorq->fd = 0;                                                          iorq->fd = 0;
# Line 860  rdpdr_abort_io(uint32 fd, uint32 major, Line 872  rdpdr_abort_io(uint32 fd, uint32 major,
872          struct async_iorequest *iorq;          struct async_iorequest *iorq;
873          struct async_iorequest *prev;          struct async_iorequest *prev;
874    
875          iorq = &g_iorequest;          iorq = g_iorequest;
876          prev = NULL;          prev = NULL;
877          while (iorq != NULL)          while (iorq != NULL)
878          {          {
# Line 869  rdpdr_abort_io(uint32 fd, uint32 major, Line 881  rdpdr_abort_io(uint32 fd, uint32 major,
881                  if ((iorq->fd == fd) && (major == 0 || iorq->major == major))                  if ((iorq->fd == fd) && (major == 0 || iorq->major == major))
882                  {                  {
883                          result = 0;                          result = 0;
884                          rdpdr_send_completion(iorq->device, iorq->id, status, result, "", 1);                          rdpdr_send_completion(iorq->device, iorq->id, status, result, (uint8*)"", 1);
885                          xfree(iorq->buffer);                          xfree(iorq->buffer);
886                          iorq->fd = 0;                          iorq->fd = 0;
887                          if (prev != NULL)                          if (prev != NULL)

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

  ViewVC Help
Powered by ViewVC 1.1.26