Method: OpenC3::InterfaceMicroservice#stop

Defined in:
lib/openc3/microservices/interface_microservice.rb

#stopObject

Disconnect from the interface and stop the thread



683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
# File 'lib/openc3/microservices/interface_microservice.rb', line 683

def stop
  @logger.info "#{@interface ? @interface.name : @name}: stop requested"
  @mutex.synchronize do
    # Need to make sure that @cancel_thread is set and the interface disconnected within
    # mutex to ensure that connect() is not called when we want to stop()
    @cancel_thread = true
    @handler_thread.stop if @handler_thread
    @interface_thread_sleeper.cancel if @interface_thread_sleeper
    if @interface
      @interface.disconnect
      if @interface_or_router == 'INTERFACE'
        valid_interface = InterfaceStatusModel.get_model(name: @interface.name, scope: @scope)
      else
        valid_interface = RouterStatusModel.get_model(name: @interface.name, scope: @scope)
      end
      valid_interface.destroy if valid_interface
    end
  end
end