Patchwork [11,of,14,RFC,c-hglib:level0] hg_current_channel: reading the channel for the current chunk of data

login
register
mail settings
Submitter Iulian Stana
Date Sept. 3, 2013, 8:30 p.m.
Message ID <9fadfe4d06beabcf95a1.1378240250@doppler>
Download mbox | patch
Permalink /patch/2317/
State Deferred, archived
Headers show

Comments

Iulian Stana - Sept. 3, 2013, 8:30 p.m.
# HG changeset patch
# User Iulian Stana <julian.stana@gmail.com>
# Date 1378236876 -10800
#      Tue Sep 03 22:34:36 2013 +0300
# Node ID 9fadfe4d06beabcf95a1f3a20a070431db795704
# Parent  ce2e0a81d30f6846e5d9bfcdfae9d6b1f060ea4f
hg_current_channel: reading the channel for the current chunk of data

Patch

diff --git a/client.c b/client.c
--- a/client.c
+++ b/client.c
@@ -342,3 +342,16 @@ 
 
 	return handle->next_header.channel;
 }
+
+/*
+ * The channel for the current chunk of data.
+ * */
+char hg_current_channel(hg_handle *handle)
+{
+	if(!handle) {
+		errno = EINVAL;
+		return -1;
+	}
+
+	return handle->current_header.channel;
+}
diff --git a/client.h b/client.h
--- a/client.h
+++ b/client.h
@@ -152,4 +152,20 @@ 
  * */
 char hg_next_channel(hg_handle *handle);
 
+/**
+ * \brief Reading the channel for the current chunk of data.
+ *
+ * Probably you haven't saved the channel from you last action and probably
+ * you still need to know what channel it was.
+ * This function will return the current channel for the connection established
+ * by the handle.
+ * \param handle The handle of the connection, wherewith I want to communicate
+ * \retval   0 if successful
+ * \retval  -1 to indicate an error, with errno set appropriately.
+ *
+ * errno can be:
+ *      - EINVAL   - Invalid argument (handle it's set to a null pointer)
+ * */
+char hg_current_channel(hg_handle *handle);
+
 #endif