Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#156 On UCSM reboot UcsHandle is not able to establish the connection. #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions ucsmsdk/ucssession.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,32 +293,36 @@ def post_elem(self, elem):
from . import ucsxmlcodec as xc

self._tx_lock_acquire_conditional(elem)
if self._is_stale_cookie(elem):
elem.attrib['cookie'] = self.cookie

self.dump_xml_request(elem)
xml_str = xc.to_xml_str(elem)

response_str = self.post_xml(xml_str)
self.dump_xml_response(response_str)

try:
if response_str:
response = xc.from_xml_str(response_str, self)
if self._is_stale_cookie(elem):
elem.attrib['cookie'] = self.cookie

# Cookie update should happen with-in the lock
# this ensures that the next packet goes out
# with the new cookie
if elem.tag == "aaaRefresh":
self._update_cookie(response)
self.dump_xml_request(elem)
xml_str = xc.to_xml_str(elem)

response_str = self.post_xml(xml_str)
self.dump_xml_response(response_str)

try:
if response_str:
response = xc.from_xml_str(response_str, self)

# Cookie update should happen with-in the lock
# this ensures that the next packet goes out
# with the new cookie
if elem.tag == "aaaRefresh":
self._update_cookie(response)

# self._tx_lock_release_conditional(elem)
# Moved to finally block
return response
except:
# self._tx_lock_release_conditional(elem)
# Moved to finally block
raise
finally:
self._tx_lock_release_conditional(elem)
return response
except:
self._tx_lock_release_conditional(elem)
raise

self._tx_lock_release_conditional(elem)
return None

def _tx_lock_acquire_conditional(self, elem):
Expand Down