Fix compilation of the example projects.
This commit is contained in:
parent
cc3299fb88
commit
cae451c4d7
|
@ -11,6 +11,7 @@ import std.functional : toDelegate;
|
||||||
import std.socket : InternetAddress;
|
import std.socket : InternetAddress;
|
||||||
import std.exception : enforce;
|
import std.exception : enforce;
|
||||||
import std.typecons : Rebindable, RefCounted;
|
import std.typecons : Rebindable, RefCounted;
|
||||||
|
import core.time : Duration;
|
||||||
import core.thread : Fiber;
|
import core.thread : Fiber;
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,7 +188,7 @@ void main()
|
||||||
|
|
||||||
print("Listening for requests on port 8080...");
|
print("Listening for requests on port 8080...");
|
||||||
while (eventDriver.core.waiterCount)
|
while (eventDriver.core.waiterCount)
|
||||||
eventDriver.core.processEvents();
|
eventDriver.core.processEvents(Duration.max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onClientConnect(StreamListenSocketFD listener, StreamSocketFD client)
|
void onClientConnect(StreamListenSocketFD listener, StreamSocketFD client)
|
||||||
|
|
|
@ -10,6 +10,8 @@ import eventcore.internal.utils;
|
||||||
import std.functional : toDelegate;
|
import std.functional : toDelegate;
|
||||||
import std.socket : InternetAddress;
|
import std.socket : InternetAddress;
|
||||||
import std.exception : enforce;
|
import std.exception : enforce;
|
||||||
|
import core.time : Duration;
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@ -20,7 +22,7 @@ void main()
|
||||||
|
|
||||||
print("Listening for requests on port 8080...");
|
print("Listening for requests on port 8080...");
|
||||||
while (eventDriver.core.waiterCount)
|
while (eventDriver.core.waiterCount)
|
||||||
eventDriver.core.processEvents();
|
eventDriver.core.processEvents(Duration.max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onClientConnect(StreamListenSocketFD listener, StreamSocketFD client)
|
void onClientConnect(StreamListenSocketFD listener, StreamSocketFD client)
|
||||||
|
@ -63,7 +65,7 @@ struct ClientHandler {
|
||||||
//print("Request: %s", cast(char[])ln);
|
//print("Request: %s", cast(char[])ln);
|
||||||
if (ln.length == 0) {
|
if (ln.length == 0) {
|
||||||
//print("Error: empty request line");
|
//print("Error: empty request line");
|
||||||
eventDriver.sockets.shutdown(client);
|
eventDriver.sockets.shutdown(client, true, true);
|
||||||
eventDriver.sockets.releaseRef(client);
|
eventDriver.sockets.releaseRef(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +91,7 @@ struct ClientHandler {
|
||||||
|
|
||||||
if (status != IOStatus.ok) {
|
if (status != IOStatus.ok) {
|
||||||
print("Client disconnect");
|
print("Client disconnect");
|
||||||
eventDriver.sockets.shutdown(client);
|
eventDriver.sockets.shutdown(client, true, true);
|
||||||
eventDriver.sockets.releaseRef(client);
|
eventDriver.sockets.releaseRef(client);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +114,7 @@ struct ClientHandler {
|
||||||
} else {
|
} else {
|
||||||
// ERROR: header line too long
|
// ERROR: header line too long
|
||||||
print("Header line too long");
|
print("Header line too long");
|
||||||
eventDriver.sockets.shutdown(client);
|
eventDriver.sockets.shutdown(client, true, true);
|
||||||
eventDriver.sockets.releaseRef(client);
|
eventDriver.sockets.releaseRef(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue