@@ -136,18 +136,15 @@ def setup_server(description=None, context=None, cmdline=None):
136136 return args
137137
138138
139- async def run_async_server (args ):
139+ async def run_async_server (args ) -> None :
140140 """Run server."""
141141 txt = f"### start ASYNC server, listening on { args .port } - { args .comm } "
142142 _logger .info (txt )
143- server = None
144143 if args .comm == "tcp" :
145144 address = (args .host if args .host else "" , args .port if args .port else None )
146- server = await StartAsyncTcpServer (
145+ await StartAsyncTcpServer (
147146 context = args .context , # Data storage
148147 identity = args .identity , # server identify
149- # TBD host=
150- # TBD port=
151148 address = address , # listen address
152149 # custom_functions=[], # allow custom handling
153150 framer = args .framer , # The framer strategy to use
@@ -160,7 +157,7 @@ async def run_async_server(args):
160157 args .host if args .host else "127.0.0.1" ,
161158 args .port if args .port else None ,
162159 )
163- server = await StartAsyncUdpServer (
160+ await StartAsyncUdpServer (
164161 context = args .context , # Data storage
165162 identity = args .identity , # server identify
166163 address = address , # listen address
@@ -173,7 +170,7 @@ async def run_async_server(args):
173170 elif args .comm == "serial" :
174171 # socat -d -d PTY,link=/tmp/ptyp0,raw,echo=0,ispeed=9600
175172 # PTY,link=/tmp/ttyp0,raw,echo=0,ospeed=9600
176- server = await StartAsyncSerialServer (
173+ await StartAsyncSerialServer (
177174 context = args .context , # Data storage
178175 identity = args .identity , # server identify
179176 # timeout=1, # waiting time for request to complete
@@ -190,9 +187,8 @@ async def run_async_server(args):
190187 )
191188 elif args .comm == "tls" :
192189 address = (args .host if args .host else "" , args .port if args .port else None )
193- server = await StartAsyncTlsServer (
190+ await StartAsyncTlsServer (
194191 context = args .context , # Data storage
195- host = "localhost" , # define tcp address where to connect to.
196192 # port=port, # on which port
197193 identity = args .identity , # server identify
198194 # custom_functions=[], # allow custom handling
@@ -210,10 +206,9 @@ async def run_async_server(args):
210206 # broadcast_enable=False, # treat slave 0 as broadcast address,
211207 # timeout=1, # waiting time for request to complete
212208 )
213- return server
214209
215210
216- async def async_helper ():
211+ async def async_helper () -> None :
217212 """Combine setup and run."""
218213 _logger .info ("Starting..." )
219214 run_args = setup_server (description = "Run asynchronous server." )
0 commit comments