Skip to contentSkip to conversation

libhail: add async TCP network writing API, atcp_wr*

PATCH New Jeff Garzik 1 participant 4 messages Sep 24, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libhail: add async TCP network writing API, atcp_wr*

Just committed into libhail... renamed the include to 'anet.h' for 'asynchronous networking'.

 include/Makefile.am |    2 
 include/anet.h      |  111 +++++++++++++++++++++++
 lib/Makefile.am     |    1 
 lib/atcp.c          |  241 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 354 insertions(+), 1 deletion(-)

commit 22de683a8f0566852818fac8b54ca26ae46490f0

Author: Jeff Garzik <[email protected]>
Date:   Thu Sep 23 20:17:56 2010 -0400

libhail: add async TCP network writing API, atcp_wr*

include/Makefile.am +1 -1
index 234cf8a..967352a 100644
@@ -5,5 +5,5 @@ EXTRA_DIST =		\
 
 include_HEADERS =	\
 	cldc.h cld_common.h ncld.h chunkc.h chunk_msg.h		\
-	hail_log.h hstor.h
+	hail_log.h hstor.h anet.h
 
include/anet.h new file +111 -0

111 lines not on this page · raw message

lib/Makefile.am +1 -0
index f7b27ff..616b881 100644
@@ -21,6 +21,7 @@ LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
 lib_LTLIBRARIES		= libhail.la
 
 libhail_la_SOURCES	=	\
+	atcp.c			\
 	cldc.c			\
 	cldc-udp.c		\
 	cldc-dns.c		\
lib/atcp.c new file +241 -0

241 lines not on this page · raw message

#1 lore raw

PATCH 1/1 tabled: use libhail's anet

Updated for move to libhail. Not committed on main branch until sme more time passes.

 server/bucket.c |    8 -
 server/object.c |   56 +++++-----
 server/server.c |  294 ++++++++++++++------------------------------------------
 server/status.c |    3 
 server/tabled.h |   45 ++------
 5 files changed, 123 insertions(+), 283 deletions(-)
server/bucket.c +4 -4
index eb03e03..a81eca1 100644
@@ -566,13 +566,13 @@ bool bucket_add(struct client *cli, const char *user, const char *bucket)
 		     bucket) < 0)
 		return cli_err(cli, InternalError);
 
-	rc = cli_writeq(cli, hdr, strlen(hdr), cli_cb_free, hdr);
+	rc = atcp_writeq(&cli->wst, hdr, strlen(hdr), atcp_cb_free, hdr);
 	if (rc) {
 		free(hdr);
 		return true;
 	}
 
-	return cli_write_start(cli);
+	return atcp_write_start(&cli->wst);
 
 err_out:
 	rc = txn->abort(txn);
@@ -718,13 +718,13 @@ bool bucket_del(struct client *cli, const char *user, const char *bucket)
 		     hutil_time2str(timestr, sizeof(timestr), time(NULL))) < 0)
 		return cli_err(cli, InternalError);
 
-	rc = cli_writeq(cli, hdr, strlen(hdr), cli_cb_free, hdr);
+	rc = atcp_writeq(&cli->wst, hdr, strlen(hdr), atcp_cb_free, hdr);
 	if (rc) {
 		free(hdr);
 		return true;
 	}
 
-	return cli_write_start(cli);
+	return atcp_write_start(&cli->wst);
 
 err_out:
 	rc = txn->abort(txn);
server/object.c +30 -26

167 lines not on this page · raw message

server/server.c +74 -220

446 lines not on this page · raw message

server/status.c +2 -1
index e9fbb38..9af60f7 100644
@@ -150,7 +150,8 @@ out_err:
 	return cli_err(cli, InternalError);
 }
 
-bool stat_evt_http_req(struct client *cli, unsigned int events)
+bool stat_evt_http_req(struct client *cli, unsigned int events,
+			bool *invalidate_cli)
 {
 	struct http_req *req = &cli->req;
 	char *method = req->method;
server/tabled.h +13 -32

95 lines not on this page · raw message

#2 lore raw

PATCH 1/1 itd: use libhail's anet

In reply to Jeff Garzik

Updated for libhail's anet. Not yet committed, waiting for more time to pass.

 Makefile.am  |    2 
 configure.ac |    1 
 iscsiutil.h  |   52 +------------
 target.c     |   53 ++++++++++----
 target.h     |    3 
 util.c       |  223 ++---------------------------------------------------------
 6 files changed, 57 insertions(+), 277 deletions(-)
Makefile.am +1 -1
index d559165..d99ab0c 100644
@@ -9,7 +9,7 @@ sbin_PROGRAMS	= itd
 itd_SOURCES	= \
 	elist.h scsi_cmd_codes.h iscsiutil.h iscsi.h parameters.h target.h \
 	main.c iscsi.c target.c util.c parameters.c
-itd_LDADD	= @GLIB_LIBS@ @CRYPTO_LIBS@ @EVENT_LIBS@
+itd_LDADD	= @GLIB_LIBS@ @CRYPTO_LIBS@ @EVENT_LIBS@ @HAIL_LIBS@
 
 EXTRA_DIST	= autogen.sh
 
configure.ac +1 -0
index 7cbbe3f..e2f6731 100644
@@ -71,6 +71,7 @@ dnl autoconf output generation
 dnl --------------------------
 
 AM_PATH_GLIB_2_0(2.0.0)
+PKG_CHECK_MODULES(HAIL, libhail)
 
 AC_SUBST(CRYPTO_LIBS)
 AC_SUBST(EVENT_LIBS)
iscsiutil.h +5 -47

77 lines not on this page · raw message

target.c +40 -13

112 lines not on this page · raw message

target.h +2 -1
index ddedb0a..e764730 100644
@@ -219,8 +219,9 @@ struct target_session {
 	int			fd;
 	struct sockaddr		addr;
 	struct event		ev;
+	struct event		write_ev;
 
-	struct tcp_write_state	wst;
+	struct atcp_wr_state	wst;
 
 	struct session_xfer	xfer;
 
util.c +8 -215

269 lines not on this page · raw message

#3 lore raw

Re: [PATCH] itd: use libhail's anet

Quoted 11 lines · Jeff Garzik

Updated for libhail's anet. Not yet committed, waiting for more time to pass.

  Makefile.am  |    2
  configure.ac |    1
  iscsiutil.h  |   52 +------------
  target.c     |   53 ++++++++++----
  target.h     |    3
  util.c       |  223 ++---------------------------------------------------------
  6 files changed, 57 insertions(+), 277 deletions(-)

This got pushed to itd.git late last night.

Jeff