simplify state copy

This commit is contained in:
Maximilian Hils 2017-02-09 14:34:31 +01:00 committed by Thomas Kriechbaumer
parent 7a205e80aa
commit d6d1ff0170
2 changed files with 2 additions and 21 deletions

View File

@ -1,6 +1,5 @@
import time
import copy
import os
from mitmproxy import stateobject
@ -82,9 +81,6 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
tls_version=str,
)
def copy(self):
return copy.copy(self)
def send(self, message):
if isinstance(message, list):
message = b''.join(message)
@ -222,9 +218,6 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
via=None
))
def copy(self):
return copy.copy(self)
def connect(self):
self.timestamp_start = time.time()
tcp.TCPClient.connect(self)

View File

@ -1,5 +1,4 @@
import time
import copy
import uuid
from mitmproxy import controller # noqa
@ -7,7 +6,7 @@ from mitmproxy import stateobject
from mitmproxy import connections
from mitmproxy import version
import typing # noqa
import typing # noqa
class Error(stateobject.StateObject):
@ -53,10 +52,6 @@ class Error(stateobject.StateObject):
f.set_state(state)
return f
def copy(self):
c = copy.copy(self)
return c
class Flow(stateobject.StateObject):
@ -116,16 +111,9 @@ class Flow(stateobject.StateObject):
return f
def copy(self):
f = copy.copy(self)
f = super().copy()
f.id = str(uuid.uuid4())
f.live = False
f.client_conn = self.client_conn.copy()
f.server_conn = self.server_conn.copy()
f.metadata = self.metadata.copy()
if self.error:
f.error = self.error.copy()
return f
def modified(self):