Fix if EPOLLIN and EPOLLOUT come together
This commit is contained in:
parent
4c4e65b373
commit
8973bdb2af
@ -3,7 +3,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* Copyright: Eugene Wissner 2016.
|
||||
* Copyright: Eugene Wissner 2016-2017.
|
||||
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
|
||||
* Mozilla Public License, v. 2.0).
|
||||
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
|
||||
@ -132,6 +132,7 @@ class EpollLoop : SelectorLoop
|
||||
else if (events[i].events & EPOLLERR)
|
||||
{
|
||||
kill(io, null);
|
||||
continue;
|
||||
}
|
||||
else if (events[i].events & (EPOLLIN | EPOLLPRI | EPOLLHUP))
|
||||
{
|
||||
@ -156,13 +157,14 @@ class EpollLoop : SelectorLoop
|
||||
if (transport.socket.disconnected)
|
||||
{
|
||||
kill(io, exception);
|
||||
continue;
|
||||
}
|
||||
else if (io.output.length)
|
||||
{
|
||||
pendings.enqueue(io);
|
||||
}
|
||||
}
|
||||
else if (events[i].events & EPOLLOUT)
|
||||
if (events[i].events & EPOLLOUT)
|
||||
{
|
||||
auto transport = cast(SelectorStreamTransport) io.transport;
|
||||
assert(transport !is null);
|
||||
|
@ -3,7 +3,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* Copyright: Eugene Wissner 2016.
|
||||
* Copyright: Eugene Wissner 2016-2017.
|
||||
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
|
||||
* Mozilla Public License, v. 2.0).
|
||||
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
|
||||
@ -17,7 +17,7 @@
|
||||
* {
|
||||
* private DuplexTransport transport;
|
||||
*
|
||||
* void received(ubyte[] data) @nogc
|
||||
* void received(in ubyte[] data) @nogc
|
||||
* {
|
||||
* transport.write(data);
|
||||
* }
|
||||
|
@ -3,7 +3,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* Copyright: Eugene Wissner 2016.
|
||||
* Copyright: Eugene Wissner 2016-2017.
|
||||
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
|
||||
* Mozilla Public License, v. 2.0).
|
||||
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
|
||||
@ -22,7 +22,7 @@ interface Protocol
|
||||
* Params:
|
||||
* data = Read data.
|
||||
*/
|
||||
void received(ubyte[] data) @nogc;
|
||||
void received(in ubyte[] data) @nogc;
|
||||
|
||||
/**
|
||||
* Called when a connection is made.
|
||||
|
@ -3,7 +3,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* Copyright: Eugene Wissner 2016.
|
||||
* Copyright: Eugene Wissner 2016-2017.
|
||||
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
|
||||
* Mozilla Public License, v. 2.0).
|
||||
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
|
||||
@ -180,6 +180,11 @@ private struct Range(E)
|
||||
return true;
|
||||
}
|
||||
|
||||
@property inout(E[]) data() inout
|
||||
{
|
||||
return begin[0 .. length];
|
||||
}
|
||||
|
||||
static if (isMutable!E)
|
||||
{
|
||||
bool opEquals(Range that)
|
||||
@ -1408,6 +1413,21 @@ struct Vector(T)
|
||||
return vector[0 .. length];
|
||||
}
|
||||
|
||||
///
|
||||
unittest
|
||||
{
|
||||
auto v = Vector!int(IL(1, 2, 4));
|
||||
|
||||
assert(v.data[0] == 1);
|
||||
assert(v.data[1] == 2);
|
||||
assert(v.data[2] == 4);
|
||||
assert(v.data.length == 3);
|
||||
|
||||
auto data = v[1 .. 2].data;
|
||||
assert(data[0] == 2);
|
||||
assert(data.length == 1);
|
||||
}
|
||||
|
||||
mixin DefaultAllocator;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user