[][src]Trait gio::SocketServiceExt

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

Trait containing all SocketService methods.

Implementors

SocketService, ThreadedSocketService

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 get_property_active(&self) -> bool

Whether the service is currently accepting connections.

Feature: v2_46

fn set_property_active(&self, active: bool)

Whether the service is currently accepting connections.

Feature: v2_46

fn connect_incoming<F: Fn(&Self, &SocketConnection, Option<&Object>) -> bool + 'static>(
    &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

fn connect_property_active_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId

Loading content...

Implementors

impl<O: IsA<SocketService>> SocketServiceExt for O[src]

Loading content...