From da42107196fb30c54738d3354461454b66dfda14 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Mon, 26 Dec 2016 08:20:22 -0500 Subject: [PATCH] Delete multi_server.dart --- bin/multi_server.dart | 65 ------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 bin/multi_server.dart diff --git a/bin/multi_server.dart b/bin/multi_server.dart deleted file mode 100644 index e44e0bf..0000000 --- a/bin/multi_server.dart +++ /dev/null @@ -1,65 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; -import 'package:angel_multiserver/angel_multiserver.dart'; - -final Uri cluster = Platform.script.resolve('cluster.dart'); -final error502 = GZIP.encode(UTF8.encode(''' - - - - 502 Bad Gateway - - -

502 Bad Gateway

- - - ''')); -final error503 = GZIP.encode(UTF8.encode(''' - - - - 503 Service Unavailable - - -

503 Service Unavailable

- There is no server available to service your request. - - - ''')); - -main() async { - var loadBalancer = new LoadBalancer(); - await loadBalancer.spawnIsolates(cluster, count: 3); - - loadBalancer - ..onCrash.listen((_) { - // Auto-spawn a new instance on crash - loadBalancer.spawnIsolates(cluster); - }) - ..onErrored.listen((socket) async { - try { - socket - ..writeln('HTTP/1.1 502 Bad Gateway') - ..writeln(HttpDate.format(new DateTime.now())) - ..writeln('Content-Encoding: gzip') - ..writeln() - ..add(error502) - ..writeln(); - await socket.close(); - } catch(_) {} - }) - ..onUnavailable.listen((socket) async { - socket - ..writeln('HTTP/1.1 503 Service Unavailable') - ..writeln(HttpDate.format(new DateTime.now())) - ..writeln('Content-Encoding: gzip') - ..writeln() - ..add(error503) - ..writeln(); - await socket.close(); - }); - - var server = await loadBalancer.startServer(); - print( - 'Load balancer listening at http://${server.address.address}:${server.port}'); -}