Trait gio::prelude::SocketServiceExt[][src]

pub trait SocketServiceExt: 'static {
    fn is_active(&self) -> bool;
fn start(&self);
fn stop(&self);
fn set_active(&self, active: bool);
fn connect_incoming<F: Fn(&Self, &SocketConnection, Option<&Object>) -> bool + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_active_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }
Expand description

Required methods

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

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 stop().

This call is thread-safe, so it may be called from a thread handling an incoming client request.

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 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.

Whether the service is currently accepting connections.

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

Implementors