MCPcopy
hub / github.com/retspen/webvirtcloud / __connection_close_callback

Method __connection_close_callback

vrtManager/connection.py:121–141  ·  view source on GitHub ↗
(self, connection, reason, opaque=None)

Source from the content-addressed store, hash-verified

119 return 0
120
121 def __connection_close_callback(self, connection, reason, opaque=None):
122 self.connection_state_lock.acquire()
123 try:
124 # on server shutdown libvirt module gets freed before the close callbacks are called
125 # so we just check here if it is still present
126 if libvirt is not None:
127 if (reason == libvirt.VIR_CONNECT_CLOSE_REASON_ERROR):
128 self.last_error = 'connection closed: Misc I/O error'
129 elif (reason == libvirt.VIR_CONNECT_CLOSE_REASON_EOF):
130 self.last_error = 'connection closed: End-of-file from server'
131 elif (reason == libvirt.VIR_CONNECT_CLOSE_REASON_KEEPALIVE):
132 self.last_error = 'connection closed: Keepalive timer triggered'
133 elif (reason == libvirt.VIR_CONNECT_CLOSE_REASON_CLIENT):
134 self.last_error = 'connection closed: Client requested it'
135 else:
136 self.last_error = 'connection closed: Unknown error'
137
138 # prevent other threads from using the connection (in the future)
139 self.connection = None
140 finally:
141 self.connection_state_lock.release()
142
143 def __connect_tcp(self):
144 flags = [libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE]

Callers

nothing calls this directly

Calls 1

releaseMethod · 0.80

Tested by

no test coverage detected