mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
msd reset now leads to inotify restart
This commit is contained in:
parent
2195acf2ff
commit
546ac24b93
@ -141,6 +141,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
|
|||||||
|
|
||||||
self.__notifier = aiotools.AioNotifier()
|
self.__notifier = aiotools.AioNotifier()
|
||||||
self.__state = _State(self.__notifier)
|
self.__state = _State(self.__notifier)
|
||||||
|
self.__reset = False
|
||||||
|
|
||||||
logger = get_logger(0)
|
logger = get_logger(0)
|
||||||
logger.info("Using OTG gadget %r as MSD", gadget)
|
logger.info("Using OTG gadget %r as MSD", gadget)
|
||||||
@ -219,6 +220,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
|
|||||||
async def reset(self) -> None:
|
async def reset(self) -> None:
|
||||||
async with self.__state.busy(check_online=False):
|
async with self.__state.busy(check_online=False):
|
||||||
try:
|
try:
|
||||||
|
self.__reset = True
|
||||||
self.__drive.set_image_path("")
|
self.__drive.set_image_path("")
|
||||||
self.__drive.set_cdrom_flag(False)
|
self.__drive.set_cdrom_flag(False)
|
||||||
self.__drive.set_rw_flag(False)
|
self.__drive.set_rw_flag(False)
|
||||||
@ -450,7 +452,8 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
|
|||||||
await self.__reload_state()
|
await self.__reload_state()
|
||||||
|
|
||||||
while self.__state.vd: # Если живы после предыдущей проверки
|
while self.__state.vd: # Если живы после предыдущей проверки
|
||||||
need_restart = False
|
need_restart = self.__reset
|
||||||
|
self.__reset = False
|
||||||
need_reload_state = False
|
need_reload_state = False
|
||||||
for event in (await inotify.get_series(timeout=1)):
|
for event in (await inotify.get_series(timeout=1)):
|
||||||
need_reload_state = True
|
need_reload_state = True
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user