Possibly strange behaviour of pymodbus.server.simulator.http_server.ModbusSimulatorServer #1763
-
| I use the .run_forever() method of ModbusSimulator to start and serve my server. However I found the code to call the asyncio.Future() object stored in self.serving:     self.serving: asyncio.Future = asyncio.Future()  
...
    async def run_forever(self, only_start=False):
        """Start modbus and http servers."""
        try:
            runner = web.AppRunner(self.web_app)
            await runner.setup()
            self.site = web.TCPSite(runner, self.http_host, self.http_port)
            await self.site.start()
        except Exception as exc:
            Log.error("Error starting http server, reason: {}", exc)
            raise exc
        Log.info("HTTP server started on ({}:{})", self.http_host, self.http_port)
        if only_start:
            return
        while True:
            await self.serving()It seems to me that the asyncio.Future object is declared and should only be awaited, like: await self.servingBut I'm not experienced enough in pymodbus to tell, hence a discussion thread rather than an issue to start with. | 
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
| Please see our example. | 
Beta Was this translation helpful? Give feedback.
-
| This looks like a bug, pull requests are welcome. | 
Beta Was this translation helpful? Give feedback.
-
| see #1771 | 
Beta Was this translation helpful? Give feedback.
Please see our example.