MCPcopy Index your code
hub / github.com/pyload/pyload / read

Method read

module/remote/thriftbackend/Socket.py:65–92  ·  view source on GitHub ↗
(self, sz)

Source from the content-addressed store, hash-verified

63 self.handle.connect((self.host, self.port))
64
65 def read(self, sz):
66 try:
67 buff = self.handle.recv(sz)
68 except socket.error, e:
69 if (e.args[0] == errno.ECONNRESET and
70 (sys.platform == 'darwin' or sys.platform.startswith('freebsd'))):
71 # freebsd and Mach don't follow POSIX semantic of recv
72 # and fail with ECONNRESET if peer performed shutdown.
73 # See corresponding comment and code in TSocket::read()
74 # in lib/cpp/src/transport/TSocket.cpp.
75 self.close()
76 # Trigger the check to raise the END_OF_FILE exception below.
77 buff = ''
78 else:
79 raise
80 except Exception, e:
81 # SSL connection was closed
82 if e.args == (-1, 'Unexpected EOF'):
83 buff = ''
84 elif e.args == ([('SSL routines', 'SSL23_GET_CLIENT_HELLO', 'unknown protocol')],):
85 #a socket not using ssl tried to connect
86 buff = ''
87 else:
88 raise
89
90 if not len(buff):
91 raise TTransportException(type=TTransportException.END_OF_FILE, message='TSocket read 0 bytes')
92 return buff
93
94
95class ServerSocket(TServerSocket, Socket):

Callers 15

processMethod · 0.45
recv_getConfigValueMethod · 0.45
recv_setConfigValueMethod · 0.45
recv_getConfigMethod · 0.45
recv_getPluginConfigMethod · 0.45
recv_pauseServerMethod · 0.45
recv_unpauseServerMethod · 0.45
recv_togglePauseMethod · 0.45
recv_statusServerMethod · 0.45
recv_freeSpaceMethod · 0.45
recv_getServerVersionMethod · 0.45
recv_killMethod · 0.45

Calls 3

TTransportExceptionClass · 0.85
recvMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected