Lines Matching refs:sock

65   def assertSocketNotConnected(self, sock):  argument
66 self.assertRaisesErrno(ENOTCONN, sock.getpeername)
68 def assertSocketConnected(self, sock): argument
69 sock.getpeername() # No errors? Socket is alive and connected.
99 def receiveFin(self, netid, version, sock): argument
100 self.assertSocketConnected(sock)
107 def sendData(self, netid, version, sock, payload): argument
108 sock.send(payload)
137 sock = self.createConnectedSocket(version, netid)
138 sock.setsockopt(SOL_TCP, TCP_REPAIR, TCP_REPAIR_ON)
141 self.assertRaisesErrno(EINVAL, sock.send, "write test")
148 self.assertRaisesErrno(EPERM, sock.recv, 4096)
150 sock.setsockopt(SOL_TCP, TCP_REPAIR, TCP_REPAIR_OFF)
151 readData = sock.recv(4096)
153 sock.close()
163 sock = self.createConnectedSocket(version, netid)
165 sequence_before = self.GetWriteSequenceNumber(version, sock)
169 self.sendData(netid, version, sock, TEST_SEND)
170 sequence_after = self.GetWriteSequenceNumber(version, sock)
174 sequence_before = self.GetReadSequenceNumber(version, sock)
179 sequence_after = self.GetReadSequenceNumber(version, sock)
181 sock.close()
183 def GetWriteSequenceNumber(self, version, sock): argument
184 sock.setsockopt(SOL_TCP, TCP_REPAIR, TCP_REPAIR_ON)
185 sock.setsockopt(SOL_TCP, TCP_REPAIR_QUEUE, TCP_SEND_QUEUE)
186 sequence = sock.getsockopt(SOL_TCP, TCP_QUEUE_SEQ)
187 sock.setsockopt(SOL_TCP, TCP_REPAIR_QUEUE, TCP_NO_QUEUE)
188 sock.setsockopt(SOL_TCP, TCP_REPAIR, TCP_REPAIR_OFF)
191 def GetReadSequenceNumber(self, version, sock): argument
192 sock.setsockopt(SOL_TCP, TCP_REPAIR, TCP_REPAIR_ON)
193 sock.setsockopt(SOL_TCP, TCP_REPAIR_QUEUE, TCP_RECV_QUEUE)
194 sequence = sock.getsockopt(SOL_TCP, TCP_QUEUE_SEQ)
195 sock.setsockopt(SOL_TCP, TCP_REPAIR_QUEUE, TCP_NO_QUEUE)
196 sock.setsockopt(SOL_TCP, TCP_REPAIR, TCP_REPAIR_OFF)
207 sock = self.createConnectedSocket(version, netid)
208 sock.setsockopt(SOL_TCP, TCP_REPAIR, TCP_REPAIR_ON)
212 thread = SocketExceptionThread(sock, lambda sk: self.fdSelect(sock, expected))
217 return sock, multiThreads
230 sock, multiThreads = self.PollRepairSocketInMultipleThreads(netid, version, expected)
232 sock.shutdown(SHUT_RD)
234 sock.close()
237 sock, multiThreads = self.PollRepairSocketInMultipleThreads(netid, version, expected)
239 sock.shutdown(SHUT_WR)
241 sock.close()
244 sock, multiThreads = self.PollRepairSocketInMultipleThreads(netid, version, expected)
246 sock.shutdown(SHUT_RDWR)
248 sock.close()
253 sock, multiThreads = self.PollRepairSocketInMultipleThreads(netid, version, expected)
254 self.receiveFin(netid, version, sock)
256 sock.close()
266 sock = self.createConnectedSocket(version, netid)
269 fcntl.ioctl(sock, SIOCINQ, buf)
274 fcntl.ioctl(sock, SIOCINQ, buf)
276 sock.close()
281 sock = self.createConnectedSocket(version, netid)
283 fcntl.ioctl(sock, SIOCOUTQ, buf)
286 sock.setsockopt(SOL_TCP, TCP_REPAIR, TCP_REPAIR_ON)
288 sock.setsockopt(SOL_TCP, TCP_REPAIR_QUEUE, TCP_SEND_QUEUE)
289 self.sendData(netid, version, sock, TEST_SEND_PAYLOAD)
290 fcntl.ioctl(sock, SIOCOUTQ, buf)
292 sock.close()
296 sock = self.createConnectedSocket(version, netid)
298 self.sendData(netid, version, sock, TEST_SEND_PAYLOAD)
299 fcntl.ioctl(sock, SIOCOUTQ, buf)
306 fcntl.ioctl(sock, SIOCOUTQ, buf)
308 sock.close()
311 def fdSelect(self, sock, expected): argument
314 p.register(sock, READ_ONLY)
317 if fd == sock.fileno():
324 def __init__(self, sock, operation): argument
328 self.sock = sock
336 self.operation(self.sock)