diff --git a/examples/http-server-fibers.d b/examples/http-server-fibers.d index b61a96e..891b79c 100644 --- a/examples/http-server-fibers.d +++ b/examples/http-server-fibers.d @@ -11,6 +11,7 @@ import std.functional : toDelegate; import std.socket : InternetAddress; import std.exception : enforce; import std.typecons : Rebindable, RefCounted; +import core.time : Duration; import core.thread : Fiber; @@ -187,7 +188,7 @@ void main() print("Listening for requests on port 8080..."); while (eventDriver.core.waiterCount) - eventDriver.core.processEvents(); + eventDriver.core.processEvents(Duration.max); } void onClientConnect(StreamListenSocketFD listener, StreamSocketFD client) diff --git a/examples/http-server.d b/examples/http-server.d index 3a643fc..1828459 100644 --- a/examples/http-server.d +++ b/examples/http-server.d @@ -10,6 +10,8 @@ import eventcore.internal.utils; import std.functional : toDelegate; import std.socket : InternetAddress; import std.exception : enforce; +import core.time : Duration; + void main() { @@ -20,7 +22,7 @@ void main() print("Listening for requests on port 8080..."); while (eventDriver.core.waiterCount) - eventDriver.core.processEvents(); + eventDriver.core.processEvents(Duration.max); } void onClientConnect(StreamListenSocketFD listener, StreamSocketFD client) @@ -63,7 +65,7 @@ struct ClientHandler { //print("Request: %s", cast(char[])ln); if (ln.length == 0) { //print("Error: empty request line"); - eventDriver.sockets.shutdown(client); + eventDriver.sockets.shutdown(client, true, true); eventDriver.sockets.releaseRef(client); } @@ -89,7 +91,7 @@ struct ClientHandler { if (status != IOStatus.ok) { print("Client disconnect"); - eventDriver.sockets.shutdown(client); + eventDriver.sockets.shutdown(client, true, true); eventDriver.sockets.releaseRef(client); return; } @@ -112,7 +114,7 @@ struct ClientHandler { } else { // ERROR: header line too long print("Header line too long"); - eventDriver.sockets.shutdown(client); + eventDriver.sockets.shutdown(client, true, true); eventDriver.sockets.releaseRef(client); } }