Fix Kqueue buil with the new watcher-transport
This commit is contained in:
parent
530a482402
commit
b1b652b943
@ -237,29 +237,26 @@ class KqueueLoop : SelectorLoop
|
|||||||
{
|
{
|
||||||
assert(connections.length > events[i].ident);
|
assert(connections.length > events[i].ident);
|
||||||
|
|
||||||
IOWatcher io = cast(IOWatcher) connections[events[i].ident];
|
auto transport = cast(SelectorStreamTransport) connections[events[i].ident];
|
||||||
// If it is a ConnectionWatcher. Accept connections.
|
// If it is a ConnectionWatcher. Accept connections.
|
||||||
if (io is null)
|
if (transport is null)
|
||||||
{
|
{
|
||||||
acceptConnections(connections[events[i].ident]);
|
acceptConnections(connections[events[i].ident]);
|
||||||
}
|
}
|
||||||
else if (events[i].flags & EV_ERROR)
|
else if (events[i].flags & EV_ERROR)
|
||||||
{
|
{
|
||||||
kill(io, null);
|
kill(transport, null);
|
||||||
}
|
}
|
||||||
else if (events[i].filter == EVFILT_READ)
|
else if (events[i].filter == EVFILT_READ)
|
||||||
{
|
{
|
||||||
auto transport = cast(SelectorStreamTransport) io.transport;
|
|
||||||
assert(transport !is null);
|
|
||||||
|
|
||||||
SocketException exception;
|
SocketException exception;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ptrdiff_t received;
|
ptrdiff_t received;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
received = transport.socket.receive(io.output[]);
|
received = transport.socket.receive(transport.output[]);
|
||||||
io.output += received;
|
transport.output += received;
|
||||||
}
|
}
|
||||||
while (received);
|
while (received);
|
||||||
}
|
}
|
||||||
@ -269,18 +266,15 @@ class KqueueLoop : SelectorLoop
|
|||||||
}
|
}
|
||||||
if (transport.socket.disconnected)
|
if (transport.socket.disconnected)
|
||||||
{
|
{
|
||||||
kill(io, exception);
|
kill(transport, exception);
|
||||||
}
|
}
|
||||||
else if (io.output.length)
|
else if (transport.output.length)
|
||||||
{
|
{
|
||||||
pendings.enqueue(io);
|
pendings.enqueue(transport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (events[i].filter == EVFILT_WRITE)
|
else if (events[i].filter == EVFILT_WRITE)
|
||||||
{
|
{
|
||||||
auto transport = cast(SelectorStreamTransport) io.transport;
|
|
||||||
assert(transport !is null);
|
|
||||||
|
|
||||||
transport.writeReady = true;
|
transport.writeReady = true;
|
||||||
if (transport.input.length)
|
if (transport.input.length)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user