From 5b9d03456d2f197bb398eef7893e663701c95238 Mon Sep 17 00:00:00 2001 From: Timo Dritschler Date: Mon, 30 Mar 2015 15:16:52 +0200 Subject: Added new optional address and port paramters to kiro_sb_serve --- src/kiro-sb.c | 8 +++++--- src/kiro-sb.h | 10 +++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/kiro-sb.c b/src/kiro-sb.c index 0c044fe..624ead2 100644 --- a/src/kiro-sb.c +++ b/src/kiro-sb.c @@ -187,7 +187,7 @@ idle_func (KiroSbPrivate *priv) gulong old_offset = header->offset; kiro_client_sync_partial (priv->client, 0, sizeof(struct KiroTrbInfo), 0); kiro_trb_refresh (priv->trb); - if ((old_offset != header->offset) && 0 < header->offset) { + if (((old_offset != header->offset) || TRUE) && 0 < header->offset) { gulong offset = (gulong) (kiro_trb_get_element (priv->trb, -1) - kiro_trb_get_raw_buffer (priv->trb)); kiro_client_sync_partial (priv->client, offset, kiro_trb_get_element_size (priv->trb), offset); g_hook_list_invoke_check (&(priv->callbacks), FALSE); @@ -218,7 +218,7 @@ kiro_sb_thaw (KiroSb *self) gboolean -kiro_sb_serve (KiroSb *self, gulong size) +kiro_sb_serve (KiroSb *self, gulong size, const gchar *addr, const gchar *port) { g_return_val_if_fail (self != NULL, FALSE); @@ -236,8 +236,10 @@ kiro_sb_serve (KiroSb *self, gulong size) void *buff = kiro_trb_get_raw_buffer (priv->trb); gulong b_size = kiro_trb_get_raw_size (priv->trb); + const gchar *port_internal = port ? port : "60010"; + priv->server = kiro_server_new (); - if (0 > kiro_server_start (priv->server, NULL, "60010", buff, b_size)) { + if (0 > kiro_server_start (priv->server, addr, port_internal, buff, b_size)) { g_debug ("Failed to start KIRO Server"); kiro_server_free (priv->server); kiro_trb_free (priv->trb); diff --git a/src/kiro-sb.h b/src/kiro-sb.h index 0af8afe..319d6f0 100644 --- a/src/kiro-sb.h +++ b/src/kiro-sb.h @@ -186,17 +186,25 @@ void kiro_sb_clear_sync_callbacks (KiroSb *sb); * Returns: A gboolean. TRUE = success. FALSE = fail. * @sb: (transfer none): The #KiroSb to perform this operation on * @size: Size in bytes of the content that will be served + * @addr: Optional address parameter to define where to listen for new + * connections. + * @port: Optional port to listen on for new connections * Description: * Allows other remote #KiroSbs to connect to this #KiroSb and clone its * memory. The internal memory is initially empty. Use the kiro_sb_push or * kiro_sb_push_dma functions to update the served data. + * If @addr is given the #KiroSb will try to bind to the InfiniBand device + * associated with the given address. If no address is given it will bind to + * the first device it can find. If @port is given, the #KiroSb will listen + * for new connections on this specific port. Otherwise, the default port + * '60010' will be used. * Note: * A #KiroSb that already 'serves' its content can no longer clone * other remote #KiroSbs. * See also: * kiro_sb_push, kiro_sb_push_dma */ -gboolean kiro_sb_serve (KiroSb *sb, gulong size); +gboolean kiro_sb_serve (KiroSb *sb, gulong size, const gchar *addr, const gchar *port); /** * kiro_sb_clone - Clone the content of a remote #KiroSb -- cgit v1.2.1