summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimo Dritschler <timo.dritschler@kit.edu>2015-03-30 15:16:52 +0200
committerTimo Dritschler <timo.dritschler@kit.edu>2015-03-30 15:16:52 +0200
commit5b9d03456d2f197bb398eef7893e663701c95238 (patch)
tree6b3036bf6e475ad069a91043ad3d540424bbdf00 /src
parent13db03534b26304cab537953f99c2db8755d753b (diff)
downloadkiro-5b9d03456d2f197bb398eef7893e663701c95238.tar.gz
kiro-5b9d03456d2f197bb398eef7893e663701c95238.tar.bz2
kiro-5b9d03456d2f197bb398eef7893e663701c95238.tar.xz
kiro-5b9d03456d2f197bb398eef7893e663701c95238.zip
Added new optional address and port paramters to kiro_sb_serve
Diffstat (limited to 'src')
-rw-r--r--src/kiro-sb.c8
-rw-r--r--src/kiro-sb.h10
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