Changeset 82905 in vbox
- Timestamp:
- Jan 29, 2020 12:28:30 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/txsclient.py
r79662 r82905 1628 1628 #def "LIST " 1629 1629 1630 @staticmethod 1631 def calcFileXferTimeout(cbFile): 1632 """ 1633 Calculates a reasonable timeout for an upload/download given the file size. 1634 1635 Returns timeout in milliseconds. 1636 """ 1637 return 30000 + cbFile / 256; # 256 KiB/s (picked out of thin air) 1638 1639 @staticmethod 1640 def calcUploadTimeout(sLocalFile): 1641 """ 1642 Calculates a reasonable timeout for an upload given the file (will stat it). 1643 1644 Returns timeout in milliseconds. 1645 """ 1646 try: cbFile = os.path.getsize(sLocalFile); 1647 except: cbFile = 1024*1024; 1648 return Session.calcFileXferTimeout(cbFile); 1649 1630 1650 def asyncUploadFile(self, sLocalFile, sRemoteFile, 1631 1651 fMode = 0, fFallbackOkay = True, cMsTimeout = 30000, fIgnoreErrors = False): … … 1640 1660 self.taskUploadFile, (sLocalFile, sRemoteFile, fMode, fFallbackOkay)); 1641 1661 1642 def syncUploadFile(self, sLocalFile, sRemoteFile, fMode = 0, fFallbackOkay = True, cMsTimeout = 30000, fIgnoreErrors = False):1662 def syncUploadFile(self, sLocalFile, sRemoteFile, fMode = 0, fFallbackOkay = True, cMsTimeout = 0, fIgnoreErrors = False): 1643 1663 """Synchronous version.""" 1664 if cMsTimeout <= 0: 1665 cMsTimeout = self.calcUploadTimeout(sLocalFile); 1644 1666 return self.asyncToSync(self.asyncUploadFile, sLocalFile, sRemoteFile, fMode, fFallbackOkay, cMsTimeout, fIgnoreErrors); 1645 1667 1646 1668 def asyncUploadString(self, sContent, sRemoteFile, 1647 fMode = 0, fFallbackOkay = True, cMsTimeout = 30000, fIgnoreErrors = False):1669 fMode = 0, fFallbackOkay = True, cMsTimeout = 0, fIgnoreErrors = False): 1648 1670 """ 1649 1671 Initiates a upload string task. … … 1653 1675 The task returns True on success, False on failure (logged). 1654 1676 """ 1677 if cMsTimeout <= 0: 1678 cMsTimeout = self.calcFileXferTimeout(len(sContent)); 1655 1679 return self.startTask(cMsTimeout, fIgnoreErrors, "uploadString", 1656 1680 self.taskUploadString, (sContent, sRemoteFile, fMode, fFallbackOkay)); 1657 1681 1658 def syncUploadString(self, sContent, sRemoteFile, fMode = 0, fFallbackOkay = True, cMsTimeout = 30000, fIgnoreErrors = False):1682 def syncUploadString(self, sContent, sRemoteFile, fMode = 0, fFallbackOkay = True, cMsTimeout = 0, fIgnoreErrors = False): 1659 1683 """Synchronous version.""" 1684 if cMsTimeout <= 0: 1685 cMsTimeout = self.calcFileXferTimeout(len(sContent)); 1660 1686 return self.asyncToSync(self.asyncUploadString, sContent, sRemoteFile, fMode, fFallbackOkay, cMsTimeout, fIgnoreErrors); 1661 1687 1662 def asyncDownloadFile(self, sRemoteFile, sLocalFile, cMsTimeout = 30000, fIgnoreErrors = False):1688 def asyncDownloadFile(self, sRemoteFile, sLocalFile, cMsTimeout = 120000, fIgnoreErrors = False): 1663 1689 """ 1664 1690 Initiates a download file task. … … 1670 1696 return self.startTask(cMsTimeout, fIgnoreErrors, "downloadFile", self.taskDownloadFile, (sRemoteFile, sLocalFile)); 1671 1697 1672 def syncDownloadFile(self, sRemoteFile, sLocalFile, cMsTimeout = 30000, fIgnoreErrors = False):1698 def syncDownloadFile(self, sRemoteFile, sLocalFile, cMsTimeout = 120000, fIgnoreErrors = False): 1673 1699 """Synchronous version.""" 1674 1700 return self.asyncToSync(self.asyncDownloadFile, sRemoteFile, sLocalFile, cMsTimeout, fIgnoreErrors); … … 1692 1718 cMsTimeout, fIgnoreErrors); 1693 1719 1694 def asyncUnpackFile(self, sRemoteFile, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False):1720 def asyncUnpackFile(self, sRemoteFile, sRemoteDir, cMsTimeout = 120000, fIgnoreErrors = False): 1695 1721 """ 1696 1722 Initiates a unpack file task. … … 1703 1729 (sRemoteFile, sRemoteDir)); 1704 1730 1705 def syncUnpackFile(self, sRemoteFile, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False):1731 def syncUnpackFile(self, sRemoteFile, sRemoteDir, cMsTimeout = 120000, fIgnoreErrors = False): 1706 1732 """Synchronous version.""" 1707 1733 return self.asyncToSync(self.asyncUnpackFile, sRemoteFile, sRemoteDir, cMsTimeout, fIgnoreErrors);
Note:
See TracChangeset
for help on using the changeset viewer.