Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
# Create a new event_base to use with the rest of Libevent
new `{ return event_base_new(); `}
# Create a new event_base to use with the rest of Libevent
new `{ return event_base_new(); `}
+
+ # Has `self` been correctly initialized?
fun is_valid: Bool do return not address_is_null
fun is_valid: Bool do return not address_is_null
# Event dispatching loop
#
# Event dispatching loop
#
# A buffer event structure, strongly associated to a connection, an input buffer and an output_buffer
extern class NativeBufferEvent `{ struct bufferevent * `}
# A buffer event structure, strongly associated to a connection, an input buffer and an output_buffer
extern class NativeBufferEvent `{ struct bufferevent * `}
+ # Write `length` bytes of `line`
fun write(line: NativeString, length: Int): Int `{
return bufferevent_write(recv, line, length);
`}
fun write(line: NativeString, length: Int): Int `{
return bufferevent_write(recv, line, length);
`}
fun length: Int `{ return evbuffer_get_length(recv); `}
end
fun length: Int `{ return evbuffer_get_length(recv); `}
end
extern class InputNativeEvBuffer
super NativeEvBuffer
extern class InputNativeEvBuffer
super NativeEvBuffer
fun drain(length: Int) `{ evbuffer_drain(recv, length); `}
end
fun drain(length: Int) `{ evbuffer_drain(recv, length); `}
end
extern class OutputNativeEvBuffer
super NativeEvBuffer
extern class OutputNativeEvBuffer
super NativeEvBuffer
# Factory to listen on sockets and create new `Connection`
class ConnectionFactory
# Factory to listen on sockets and create new `Connection`
class ConnectionFactory
+ # The `NativeEventBase` for the dispatch loop of this factory
var event_base: NativeEventBase
# On new connection, create the handler `Connection` object
var event_base: NativeEventBase
# On new connection, create the handler `Connection` object