Changeset 1897 for pykota/trunk/bin/cupspykota
- Timestamp:
- 11/01/04 16:45:25 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r1820 r1897 24 24 # 25 25 # $Log$ 26 # Revision 1.75 2004/11/01 15:45:25 jalet 27 # Added many debug messages. 28 # Added some code to prevent short writes. 29 # 26 30 # Revision 1.74 2004/10/13 20:51:27 jalet 27 31 # Made debugging levels be the same in cupspykota and lprngpykota. … … 531 535 endinput = endoutput = 0 532 536 inputclosed = outputclosed = 0 537 totaltochild = totalfromcups = 0 538 totalfromchild = totaltocups = 0 533 539 534 540 if self.preserveinputfile is None : … … 582 588 if indata : 583 589 try : 584 os.write(fd, indata)590 nbwritten = os.write(fd, indata) 585 591 except (OSError, IOError), msg : 586 592 self.logdebug("Error while writing to real backend's stdin %s : %s" % (fd, msg)) 587 593 else : 588 indata = "" 594 if len(indata) != nbwritten : 595 self.logdebug("Short write to real backend's input !") 596 totaltochild += nbwritten 597 self.logdebug("%s bytes sent to real backend so far..." % totaltochild) 598 indata = indata[nbwritten:] 589 599 else : 590 600 self.logdebug("No data to send to real backend yet, sleeping a bit...") … … 599 609 if outdata : 600 610 try : 601 os.write(fd, outdata)611 nbwritten = os.write(fd, outdata) 602 612 except (OSError, IOError), msg : 603 613 self.logdebug("Error while writing to CUPS back channel (stderr) %s : %s" % (fd, msg)) 604 614 else : 605 outdata = "" 615 if len(outdata) != nbwritten : 616 self.logdebug("Short write to stderr (CUPS) !") 617 totaltocups += nbwritten 618 self.logdebug("%s bytes sent back to CUPS so far..." % totaltocups) 619 outdata = outdata[nbwritten:] 606 620 else : 607 621 # self.logdebug("No data to send back to CUPS yet, sleeping a bit...") # Uncommenting this fills your logs … … 629 643 else : 630 644 indata += data 645 totalfromcups += len(data) 646 self.logdebug("%s bytes read from CUPS so far..." % totalfromcups) 631 647 elif fd == fromcfno : 632 648 if not data : … … 635 651 else : 636 652 outdata += data 653 totalfromchild += len(data) 654 self.logdebug("%s bytes read from real backend so far..." % totalfromchild) 637 655 else : 638 656 self.logdebug("Unexpected : %s - Sleeping a bit..." % self.formatFileEvent(fd, mask)) … … 669 687 670 688 self.logdebug("Exiting streams polling loop...") 689 690 self.logdebug("input data's final length : %s" % len(indata)) 691 self.logdebug("back-channel data's final length : %s" % len(outdata)) 692 693 self.logdebug("Total bytes read from CUPS (job's datas) : %s" % totalfromcups) 694 self.logdebug("Total bytes sent to real backend (job's datas) : %s" % totaltochild) 695 696 self.logdebug("Total bytes read from real backend (back-channel datas) : %s" % totalfromchild) 697 self.logdebug("Total bytes sent back to CUPS (back-channel datas) : %s" % totaltocups) 671 698 672 699 # Check exit code of original CUPS backend.