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)