Commit 8cf80640 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Implement handleAbortTransaction.

git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@154 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent bc4b9f02
......@@ -62,8 +62,9 @@ class EventHandler(object):
def packetMalformed(self, conn, packet, error_message):
"""Called when a packet is malformed."""
logging.info('malformed packet from %s:%d: %s',
conn.getAddress()[0], conn.getAddress()[1], error_message)
logging.info('malformed packet %x from %s:%d: %s',
packet.getType(), conn.getAddress()[0],
conn.getAddress()[1], error_message)
conn.addPacket(Packet().protocolError(packet.getId(), error_message))
conn.abort()
self.peerBroken(conn)
......
......@@ -206,3 +206,6 @@ class StorageEventHandler(EventHandler):
compression, checksum, data, tid):
self.handleUnexpectedPacket(conn, packet)
def handleAbortTransaction(self, conn, packet, tid):
logging.info('ignoring abort transaction')
pass
......@@ -394,3 +394,27 @@ class OperationEventHandler(StorageEventHandler):
oid, serial))
app.store_lock_dict[oid] = tid
def handleAbortTransaction(self, conn, packet, tid):
uuid = conn.getUUID()
if uuid is None:
self.handleUnexpectedPacket(conn, packet)
return
app = self.app
try:
t = app.transaction_dict[tid]
object_list = t.getObjectList()
for o in object_list:
oid = o[0]
try:
del app.load_lock_dict[oid]
except KeyError:
pass
del app.store_lock_dict[oid]
del app.transaction_dict[tid]
# Now it may be possible to execute some events.
app.executeQueuedEvents()
except KeyError:
pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment