From 2ec859f1021d0948b81c83700b0cee39342b5204 Mon Sep 17 00:00:00 2001 From: Adi Roiban Date: Tue, 23 Aug 2022 17:31:07 +0100 Subject: [PATCH 1/3] Initial copy paste with the code from Thomas --- index.html | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 74e8d38..22742f9 100644 --- a/index.html +++ b/index.html @@ -180,7 +180,9 @@

                   
-from twisted.internet import protocol, reactor, endpoints
+import math
+
+from twisted.internet import protocol, endpoints, task
 
 class Echo(protocol.Protocol):
     def dataReceived(self, data):
@@ -190,8 +192,16 @@ 

def buildProtocol(self, addr): return Echo() -endpoints.serverFromString(reactor, "tcp:1234").listen(EchoFactory()) -reactor.run() +async def echo_server(reactor): + await endpoints.serverFromString(reactor, "tcp:1234").listen(EchoFactory()) + await task.deferLater(reactor, math.inf, lambda: pass) + return 0 + +def main(): + return task.react(echo_server) + +if __name__ == "__main__": + sys.exit(main())

From 5a09c1b8aa7e21a98d4f9211434179bc49338721 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 13 Sep 2022 07:43:16 +0100 Subject: [PATCH 2/3] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 22742f9..fc782c4 100644 --- a/index.html +++ b/index.html @@ -194,7 +194,7 @@

async def echo_server(reactor): await endpoints.serverFromString(reactor, "tcp:1234").listen(EchoFactory()) - await task.deferLater(reactor, math.inf, lambda: pass) + await task.deferLater(reactor, math.inf) return 0 def main(): From 967d7dcb44b28faf8c2bdfb21c63a94c687b67b8 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 13 Sep 2022 07:46:39 +0100 Subject: [PATCH 3/3] Update index.html --- index.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index fc782c4..f825ad5 100644 --- a/index.html +++ b/index.html @@ -181,25 +181,31 @@

                   
 import math
+import sys
+
+from twisted.internet import endpoints, protocol, task
 
-from twisted.internet import protocol, endpoints, task
 
 class Echo(protocol.Protocol):
     def dataReceived(self, data):
         self.transport.write(data)
 
+
 class EchoFactory(protocol.Factory):
     def buildProtocol(self, addr):
         return Echo()
 
+
 async def echo_server(reactor):
     await endpoints.serverFromString(reactor, "tcp:1234").listen(EchoFactory())
     await task.deferLater(reactor, math.inf)
     return 0
 
+
 def main():
     return task.react(echo_server)
 
+
 if __name__ == "__main__":
     sys.exit(main())