Interface DBusServer.NewConnectionCallback
- All Superinterfaces:
FunctionPointer
- Enclosing class:
DBusServer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface declaration of the NewConnectionCallback callback.
- Since:
- 2.26
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanrun(@Nullable DBusConnection connection) Emitted when a new authenticated connection has been made.default MemorySegmenttoCallback(Arena arena) Creates a native function pointer to theupcall(MemorySegment, MemorySegment)method.default intupcall(MemorySegment sourceDBusServer, MemorySegment connection) Theupcallmethod is called from native code.
-
Method Details
-
run
Emitted when a new authenticated connection has been made. Use g_dbus_connection_get_peer_credentials() to figure out what identity (if any), was authenticated.
If you want to accept the connection, take a reference to the
connectionobject and returntrue. When you are done with the connection call g_dbus_connection_close() and give up your reference. Note that the other peer may disconnect at any time - a typical thing to do when accepting a connection is to listen to theGDBusConnection::closed signal.If
GDBusServer:flags containsDBusServerFlags.RUN_IN_THREADthen the signal is emitted in a new thread dedicated to the connection. Otherwise the signal is emitted in the thread-default main context (see MainContext#pushThreadDefault) of the thread thatserverwas constructed in.You are guaranteed that signal handlers for this signal runs before incoming messages on
connectionare processed. This means that it's suitable to call g_dbus_connection_register_object() or similar from the signal handler.- Since:
- 2.26
-
upcall
Theupcallmethod is called from native code. The parameters are marshaled andrun(DBusConnection)is executed. -
toCallback
Creates a native function pointer to theupcall(MemorySegment, MemorySegment)method.- Specified by:
toCallbackin interfaceFunctionPointer- Parameters:
arena- the arena in which the function pointer is allocated- Returns:
- the native function pointer
-