Skip to content

Commit

Permalink
afsocket: allow extending the connection restore capabilities
Browse files Browse the repository at this point in the history
Signed-off-by: Tamás Kosztyu <tamas.kosztyu@axoflow.com>
  • Loading branch information
sodomelle committed Dec 16, 2024
1 parent 3323184 commit cb194e2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion modules/afsocket/afsocket-dest.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,15 @@ afsocket_dd_setup_addresses_method(AFSocketDestDriver *self)
return TRUE;
}

static void
_on_connection_restore(AFSocketDestDriver *self, ReloadStoreItem *item)
{
if (self->on_connection_restore)
{
self->on_connection_restore(self, item);
}
}

static gboolean
_afsocket_dd_try_to_restore_connection_state(AFSocketDestDriver *self)
{
Expand All @@ -463,7 +472,10 @@ _afsocket_dd_try_to_restore_connection_state(AFSocketDestDriver *self)
return FALSE;

if (_is_protocol_compatible_with_writer_after_reload(self, item))
self->writer = _reload_store_item_release_writer(item);
{
_on_connection_restore(self, item);
self->writer = _reload_store_item_release_writer(item);
}

self->dest_addr = g_sockaddr_ref(item->dest_addr);
_reload_store_item_free(item);
Expand Down
1 change: 1 addition & 0 deletions modules/afsocket/afsocket-dest.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ struct _AFSocketDestDriver
LogWriter *(*construct_writer)(AFSocketDestDriver *self);
gboolean (*setup_addresses)(AFSocketDestDriver *s);
const gchar *(*get_dest_name)(const AFSocketDestDriver *s);
void (*on_connection_restore)(AFSocketDestDriver *s, ReloadStoreItem *ri);
};

static inline LogWriter *
Expand Down

0 comments on commit cb194e2

Please sign in to comment.