def logTxFrame(self, opcode, payload, fin, rsv, mask, payload_len, chopsize, sync): if self.createStats: self.txFrameStats[opcode] = self.txFrameStats.get(opcode, 0) + 1 if self.createWirelog: d = str(buffer(payload)) self.wirelog.append(("TF", self.asciiLogData(d), opcode, fin, rsv, mask, payload_len, chopsize, sync)) else: WebSocketProtocol.logTxFrame(self, opcode, payload, fin, rsv, mask, payload_len, chopsize, sync)
def logRxFrame(self, fin, rsv, opcode, masked, payload_len, mask, payload): if self.createStats: self.rxFrameStats[opcode] = self.rxFrameStats.get(opcode, 0) + 1 if self.createWirelog: d = str(buffer(payload)) self.wirelog.append(("RF", self.asciiLogData(d), opcode, fin, rsv, masked, mask)) else: WebSocketProtocol.logRxFrame(self, fin, rsv, opcode, masked, payload_len, mask, payload)
def logTxOctets(self, data, sync): if self.createStats: l = len(data) self.txOctetStats[l] = self.txOctetStats.get(l, 0) + 1 if self.createWirelog: d = str(buffer(data)) self.wirelog.append(("TO", self.binLogData(d), sync)) else: WebSocketProtocol.logTxOctets(self, data, sync)
def logRxFrame(self, fin, rsv, opcode, masked, payload_len, mask, payload): if self.createStats: self.rxFrameStats[opcode] = self.rxFrameStats.get(opcode, 0) + 1 if self.createWirelog: d = str(buffer(payload)) self.wirelog.append( ("RF", self.asciiLogData(d), opcode, fin, rsv, masked, mask)) else: WebSocketProtocol.logRxFrame(self, fin, rsv, opcode, masked, payload_len, mask, payload)
def connectionLost(self, reason): if self.runCase: self.runCase.onConnectionLost(self.failedByMe) self.caseEnd = time.time() caseResult = { "case": self.case, "id": caseClasstoId(self.Case), "description": self.Case.DESCRIPTION, "expectation": self.Case.EXPECTATION, "agent": self.caseAgent, "started": self.caseStarted, "duration": int(round( 1000. * (self.caseEnd - self.caseStart))), # case execution time in ms "reportTime": self.runCase. reportTime, # True/False switch to control report output of duration "behavior": self.runCase.behavior, "behaviorClose": self.runCase.behaviorClose, "expected": self.runCase.expected, "expectedClose": self.runCase.expectedClose, "received": self.runCase.received, "result": self.runCase.result, "resultClose": self.runCase.resultClose, "wirelog": self.wirelog, "createWirelog": self.createWirelog, "closedByMe": self.closedByMe, "failedByMe": self.failedByMe, "droppedByMe": self.droppedByMe, "wasClean": self.wasClean, "wasNotCleanReason": self.wasNotCleanReason, "wasServerConnectionDropTimeout": self.wasServerConnectionDropTimeout, "wasCloseHandshakeTimeout": self.wasCloseHandshakeTimeout, "localCloseCode": self.localCloseCode, "localCloseReason": self.localCloseReason, "remoteCloseCode": self.remoteCloseCode, "remoteCloseReason": self.remoteCloseReason, "isServer": self.isServer, "createStats": self.createStats, "rxOctetStats": self.rxOctetStats, "rxFrameStats": self.rxFrameStats, "txOctetStats": self.txOctetStats, "txFrameStats": self.txFrameStats, "httpRequest": self.http_request_data, "httpResponse": self.http_response_data } self.factory.logCase(caseResult) # parent's connectionLost does useful things WebSocketProtocol.connectionLost(self, reason)
def connectionLost(self, reason): if self.runCase: self.runCase.onConnectionLost(self.failedByMe) self.caseEnd = time.time() caseResult = { "case": self.case, "id": caseClasstoId(self.Case), "description": self.Case.DESCRIPTION, "expectation": self.Case.EXPECTATION, "agent": self.caseAgent, "started": self.caseStarted, "duration": int(round(1000.0 * (self.caseEnd - self.caseStart))), # case execution time in ms "reportTime": self.runCase.reportTime, # True/False switch to control report output of duration "behavior": self.runCase.behavior, "behaviorClose": self.runCase.behaviorClose, "expected": self.runCase.expected, "expectedClose": self.runCase.expectedClose, "received": self.runCase.received, "result": self.runCase.result, "resultClose": self.runCase.resultClose, "wirelog": self.wirelog, "createWirelog": self.createWirelog, "closedByMe": self.closedByMe, "failedByMe": self.failedByMe, "droppedByMe": self.droppedByMe, "wasClean": self.wasClean, "wasNotCleanReason": self.wasNotCleanReason, "wasServerConnectionDropTimeout": self.wasServerConnectionDropTimeout, "wasCloseHandshakeTimeout": self.wasCloseHandshakeTimeout, "localCloseCode": self.localCloseCode, "localCloseReason": self.localCloseReason, "remoteCloseCode": self.remoteCloseCode, "remoteCloseReason": self.remoteCloseReason, "isServer": self.isServer, "createStats": self.createStats, "rxOctetStats": self.rxOctetStats, "rxFrameStats": self.rxFrameStats, "txOctetStats": self.txOctetStats, "txFrameStats": self.txFrameStats, "httpRequest": self.http_request_data, "httpResponse": self.http_response_data, } self.factory.logCase(caseResult) # parent's connectionLost does useful things WebSocketProtocol.connectionLost(self, reason)