Esempio n. 1
0
    def process_named_pipe(self, rc, handles, mgmt_handles):
        """ Read data from the named pipe and perform the appropriate action

        """
        hr, data = ReadFile(self.pipe_handle, 256)
        if data.strip() == 'refreshdirectories':
            unwatch_directories(self.handles[:-len(mgmt_handles)])
            newhandles = watch_directories()
            newhandles.extend(self.mgmt_handles)
            self.handles = newhandles
            pass
        elif data.strip() == 'restartwebserver':
            #restart webserver
            pass
        DisconnectNamedPipe(self.pipe_handle)
        return False
Esempio n. 2
0
    def SvcStop(self):
        # Before we do anything, tell the SCM we are starting the stop process.
        self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)

        # stop the process if necessary
        self.thread_event.clear()
        self.service_thread.join()

        # And set my event.
        win32event.SetEvent(self.hWaitStop)

        # Clear any watched directories
        unwatch_directories(self.handles[:-2])

        # Close named pipe
        if self.pipe_handle:
            DisconnectNamedPipe(self.pipe_handle)
            CloseHandle(self.pipe_handle)