[−][src]Trait gio::SocketServiceExt
Required methods
fn is_active(&self) -> bool
Check whether the service is active or not. An active service will accept new clients that connect, while a non-active service will let connecting clients queue up until the service is started.
Returns
true if the service is active, false otherwise
fn start(&self)
Restarts the service, i.e. start accepting connections
from the added sockets when the mainloop runs. This only needs
to be called after the service has been stopped from
SocketServiceExt::stop.
This call is thread-safe, so it may be called from a thread handling an incoming client request.
fn stop(&self)
Stops the service, i.e. stops accepting connections from the added sockets when the mainloop runs.
This call is thread-safe, so it may be called from a thread handling an incoming client request.
Note that this only stops accepting new connections; it does not
close the listening sockets, and you can call
SocketServiceExt::start again later to begin listening again. To
close the listening sockets, call SocketListenerExt::close. (This
will happen automatically when the SocketService is finalized.)
This must be called before calling SocketListenerExt::close as
the socket service will start accepting connections immediately
when a new socket is added.
fn connect_incoming<F: Fn(&Self, &SocketConnection, Option<&Object>) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The ::incoming signal is emitted when a new incoming connection
to service needs to be handled. The handler must initiate the
handling of connection, but may not block; in essence,
asynchronous operations must be used.
connection will be unreffed once the signal handler returns,
so you need to ref it yourself if you are planning to use it.
connection
a new SocketConnection object
source_object
the source_object passed to
SocketListenerExt::add_address
Returns
true to stop other handlers from being called