Merge pull request #184 from coreemu/bugfix/add-session-class-to-create_session
allow passing in a Session class to CoreEmu.create_session() helper
This commit is contained in:
commit
e07140338d
1 changed files with 3 additions and 2 deletions
|
@ -853,12 +853,13 @@ class CoreEmu(object):
|
||||||
for session in sessions.itervalues():
|
for session in sessions.itervalues():
|
||||||
session.shutdown()
|
session.shutdown()
|
||||||
|
|
||||||
def create_session(self, _id=None, master=True):
|
def create_session(self, _id=None, master=True, _cls=EmuSession):
|
||||||
"""
|
"""
|
||||||
Create a new CORE session, set to master if running standalone.
|
Create a new CORE session, set to master if running standalone.
|
||||||
|
|
||||||
:param int _id: session id for new session
|
:param int _id: session id for new session
|
||||||
:param bool master: sets session to master
|
:param bool master: sets session to master
|
||||||
|
:param class _cls: EmuSession class to use
|
||||||
:return: created session
|
:return: created session
|
||||||
:rtype: EmuSession
|
:rtype: EmuSession
|
||||||
"""
|
"""
|
||||||
|
@ -870,7 +871,7 @@ class CoreEmu(object):
|
||||||
if session_id not in self.sessions:
|
if session_id not in self.sessions:
|
||||||
break
|
break
|
||||||
|
|
||||||
session = EmuSession(session_id, config=self.config)
|
session = _cls(session_id, config=self.config)
|
||||||
logger.info("created session: %s", session_id)
|
logger.info("created session: %s", session_id)
|
||||||
if master:
|
if master:
|
||||||
session.master = True
|
session.master = True
|
||||||
|
|
Loading…
Add table
Reference in a new issue