Function anjay_transport_enter_offline

Function Documentation

int anjay_transport_enter_offline(anjay_t *anjay, anjay_transport_set_t transport_set)

Puts all the transports specified by transport_set into offline mode. This should be done when the connectivity for these transports is deemed unavailable or lost.

During subsequent calls to anjay_sched_run, Anjay will close all of the sockets corresponding to the specified transport and stop attempting to make any contact with remote hosts over it, until a call to anjay_transport_exit_offline for any of the corresponding transports.

Note that offline mode also affects downloads. E.g., putting the TCP transport into offline mode will pause all ongoing downloads over TCP and prevent new such download requests from being performed.

User code shall still interface normally with the library, even if all the transports are in the offline state. This include regular calls to anjay_sched_run. Notifications (as reported using anjay_notify_changed and anjay_notify_instances_changed) continue to be tracked, and may be sent after reconnecting, depending on values of the “Notification Storing When Disabled or Offline” resource.

Parameters:
  • anjay – Anjay object to operate on.

  • transport_set – Set of transports to put into offline mode.

Returns:

0 on success, a negative value in case of error.