105 |
105 |
106 @param fn filename to be translated |
106 @param fn filename to be translated |
107 @type str |
107 @type str |
108 @param remote2local flag indicating the direction of translation |
108 @param remote2local flag indicating the direction of translation |
109 (False = local to remote, True = remote to local) (defaults to True) |
109 (False = local to remote, True = remote to local) (defaults to True) |
|
110 (unused) |
110 @type bool (optional) |
111 @type bool (optional) |
111 @return translated filename |
112 @return translated filename |
112 @rtype str |
113 @rtype str |
113 """ |
114 """ |
114 return fn |
115 return fn |
1589 Private method to handle data from the client. |
1590 Private method to handle data from the client. |
1590 |
1591 |
1591 @param sock reference to the socket to read data from |
1592 @param sock reference to the socket to read data from |
1592 @type QTcpSocket |
1593 @type QTcpSocket |
1593 """ |
1594 """ |
|
1595 headerSize = struct.calcsize(b"!II") |
|
1596 |
1594 while sock and sock.bytesAvailable(): |
1597 while sock and sock.bytesAvailable(): |
1595 header = sock.read(struct.calcsize(b"!II")) |
1598 now = time.monotonic() |
|
1599 while sock.bytesAvailable() < headerSize: |
|
1600 sock.waitForReadyRead(50) |
|
1601 if time.monotonic() - now > 2.0: # 2 seconds timeout |
|
1602 return |
|
1603 header = sock.read(headerSize) |
1596 length, datahash = struct.unpack(b"!II", header) |
1604 length, datahash = struct.unpack(b"!II", header) |
1597 |
1605 |
1598 data = bytearray() |
1606 data = bytearray() |
1599 now = time.monotonic() |
1607 now = time.monotonic() |
1600 while len(data) < length: |
1608 while len(data) < length: |