You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by pq...@apache.org on 2006/12/06 09:57:34 UTC

svn commit: r482974 - in /labs/dworker/trunk: LICENSE Makefile.in NOTICE README TODO build/ buildconf client/ config.layout configure.in doap.rdf docs/ include/ include/dw_version.h include/dworker.h server/ server/dw_example.c server/dworker.c

Author: pquerna
Date: Wed Dec  6 00:57:32 2006
New Revision: 482974

URL: http://svn.apache.org/viewvc?view=rev&rev=482974
Log:
Import dworker from my local repo.

Added:
    labs/dworker/trunk/LICENSE
    labs/dworker/trunk/Makefile.in
    labs/dworker/trunk/NOTICE
    labs/dworker/trunk/README
    labs/dworker/trunk/TODO
    labs/dworker/trunk/build/
    labs/dworker/trunk/buildconf   (with props)
    labs/dworker/trunk/client/
    labs/dworker/trunk/config.layout
    labs/dworker/trunk/configure.in
    labs/dworker/trunk/doap.rdf
    labs/dworker/trunk/docs/
    labs/dworker/trunk/include/
    labs/dworker/trunk/include/dw_version.h   (with props)
    labs/dworker/trunk/include/dworker.h   (with props)
    labs/dworker/trunk/server/
    labs/dworker/trunk/server/dw_example.c   (with props)
    labs/dworker/trunk/server/dworker.c   (with props)

Added: labs/dworker/trunk/LICENSE
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/LICENSE?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/LICENSE (added)
+++ labs/dworker/trunk/LICENSE Wed Dec  6 00:57:32 2006
@@ -0,0 +1,297 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+
+APACHE PORTABLE RUNTIME SUBCOMPONENTS: 
+
+The Apache Portable Runtime includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses. 
+
+From strings/apr_fnmatch.c, include/apr_fnmatch.h, misc/unix/getopt.c,
+file_io/unix/mktemp.c, strings/apr_strings.c:
+
+/* 
+ * Copyright (c) 1987, 1993, 1994
+ *      The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by the University of
+ *      California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+
+From network_io/unix/inet_ntop.c, network_io/unix/inet_pton.c:
+
+/* Copyright (c) 1996 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+
+From dso/aix/dso.c:
+
+ *  Based on libdl (dlfcn.c/dlfcn.h) which is
+ *  Copyright (c) 1992,1993,1995,1996,1997,1988
+ *  Jens-Uwe Mager, Helios Software GmbH, Hannover, Germany.
+ *
+ *  Not derived from licensed software.
+ *
+ *  Permission is granted to freely use, copy, modify, and redistribute
+ *  this software, provided that the author is not construed to be liable
+ *  for any results of using the software, alterations are clearly marked
+ *  as such, and this notice is not modified.
+
+From strings/apr_strnatcmp.c, include/apr_strings.h:
+
+  strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
+  Copyright (C) 2000 by Martin Pool <mb...@humbug.org.au>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+

Added: labs/dworker/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/Makefile.in?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/Makefile.in (added)
+++ labs/dworker/trunk/Makefile.in Wed Dec  6 00:57:32 2006
@@ -0,0 +1,95 @@
+srcdir=@srcdir@
+VPATH=@srcdir@
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libexecdir=@libexecdir@
+bindir=@bindir@
+libdir=@libdir@
+includedir=@includedir@
+
+LIB_OBJECTS=
+
+DW_MAJOR_VERSION=@DW_MAJOR_VERSION@
+DW_DOTTED_VERSION=@DW_DOTTED_VERSION@
+
+TARGET_LIB=
+
+PROGRAMS=server/dworker
+
+MODULES=server/dw_example.la
+
+HEADERS=include/dw_version.h \
+        include/dworker.h
+
+PRIVATE_HEADERS=
+
+HEADERS_DEP=${HEADERS} ${PRIVATE_HEADERS}
+
+LIBTOOL=@APR_LIBTOOL@ --silent
+MKDIR = @mkdir_p@
+INSTALL = @INSTALL@
+CC=@CC@
+CFLAGS=@CFLAGS@
+CPPFLAGS=@CPPFLAGS@
+INCLUDES=-I$(srcdir)/include \
+         -I@APR_INCLUDEDIR@ \
+         -I@APU_INCLUDEDIR@ \
+         $(EXTRA_INCLUDES)
+
+LDFLAGS=@LDFLAGS@
+LIBS=@DW_LIBS@
+
+all: $(TARGET_LIB) $(PROGRAMS) $(MODULES)
+
+server/dworker.lo: server/dworker.c ${HEADERS_DEP}
+server/dw_example.lo: server/dw_example.c ${HEADERS_DEP}
+
+$(TARGET_LIB): $(LIB_OBJECTS)
+	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -rpath $(libdir) -o $@ $^ $(LIBS)
+
+server/dw_example.la: $(TARGET_LIB) server/dw_example.lo
+	$(MKDIR) .libs/server/
+	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ -module -avoid-version -rpath $(libdir) $^ $(LIBS)
+
+server/dworker: $(TARGET_LIB) server/dworker.lo
+	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -static -o $@ $^ $(LIBS)
+
+docs:
+	doxygen www/doxygen.conf
+
+clean:
+	@rm -rf $(TARGET_LIB)
+	@rm -rf $(LIB_OBJECTS)
+	@rm -rf $(PROGRAMS)
+	@rm -rf $(LIB_OBJECTS:.lo=.o)
+	@rm -rf server/dworker.o
+	@rm -rf server/dworker.lo
+	@rm -rf server/dw_example.o
+	@rm -rf server/dw_example.lo
+	@rm -rf server/dw_example.la
+
+distclean: clean
+	@rm -rf Makefile
+	@rm -rf config.log
+	@rm -rf config.status
+	@rm -rf .libs
+	@rm -rf server/.libs
+	@rm -rf client/.libs
+
+install: $(TARGET_LIB) $(PROGRAMS)
+	$(MKDIR) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
+	$(MKDIR) $(DESTDIR)$(libdir) $(DESTDIR)$(libexecdir)
+	$(MKDIR) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir)
+	$(MKDIR) $(DESTDIR)$(libdir) $(DESTDIR)$(libdir)
+	$(LIBTOOL) --mode=install $(INSTALL) -m 755 server/dworker $(DESTDIR)$(bindir)
+	$(LIBTOOL) --mode=install $(INSTALL) -m 644 -module -avoid-version server/dw_example.la $(DESTDIR)$(libexecdir)
+	for i in $(srcdir)/include/*.h; do \
+		$(INSTALL) -m 644 $$i $(DESTDIR)$(includedir); \
+	done
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o
+
+.c.lo:
+	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c -o $@ $< && touch $@

Added: labs/dworker/trunk/NOTICE
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/NOTICE?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/NOTICE (added)
+++ labs/dworker/trunk/NOTICE Wed Dec  6 00:57:32 2006
@@ -0,0 +1,2 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).

Added: labs/dworker/trunk/README
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/README?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/README (added)
+++ labs/dworker/trunk/README Wed Dec  6 00:57:32 2006
@@ -0,0 +1,6 @@
+dworker - A distributed task execution system
+
+Dependencies:
+  APR  >= 1.3 (svn trunk)
+  APR-Util >= 1.3 (svn trunk)
+

Added: labs/dworker/trunk/TODO
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/TODO?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/TODO (added)
+++ labs/dworker/trunk/TODO Wed Dec  6 00:57:32 2006
@@ -0,0 +1,21 @@
+
+Server:
+  - Protocol Parsing.
+  - Server Side Language support:
+      - Lua
+      - PHP
+      - Python
+
+
+Client:
+  - Simple Blocking Invoke API
+  - Bulk Invoke API
+  - Multiple Server Support
+  - Language Bindings:
+     - Lua
+     - PHP
+     - Python
+
+Docs:
+  - Examples
+  - Performance Examples/Benchmarks/Latency

Added: labs/dworker/trunk/buildconf
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/buildconf?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/buildconf (added)
+++ labs/dworker/trunk/buildconf Wed Dec  6 00:57:32 2006
@@ -0,0 +1,123 @@
+#!/bin/sh
+#
+# Copyright 2005 Justin Erenkrantz and Greg Stein
+# Copyright 2005 The Apache Software Foundation or its licensors, as
+# applicable.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+# buildconf: Build the support scripts needed to compile from a
+#            checked-out version of the source code.
+
+# set a couple of defaults for where we should be looking for our support libs.
+# can be overridden with --with-apr=[dir] and --with-apr-util=[dir]
+
+apr_src_dir="apr ../apr"
+apu_src_dir="apr-util ../apr-util"
+
+while test $# -gt 0 
+do
+  # Normalize
+  case "$1" in
+  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  case "$1" in
+  --with-apr=*)
+  apr_src_dir=$optarg
+  ;;
+  esac
+
+  case "$1" in
+  --with-apr-util=*)
+  apu_src_dir=$optarg
+  ;;
+  esac
+
+  shift
+done
+
+#
+# Check to be sure that we have the srclib dependencies checked-out
+#
+
+should_exit=0
+apr_found=0
+apu_found=0
+
+for dir in $apr_src_dir
+do
+    if [ -d "${dir}" -a -f "${dir}/build/apr_common.m4" ]; then
+        echo "found apr source: ${dir}"
+        apr_src_dir=$dir
+        apr_found=1
+        break
+    fi
+done
+
+if [ $apr_found -lt 1 ]; then
+    echo ""
+    echo "You don't have a copy of the apr source in srclib/apr. "
+    echo "Please get the source using the following instructions," 
+    echo "or specify the location of the source with " 
+    echo "--with-apr=[path to apr] :"
+    echo ""
+    echo "   svn co http://svn.apache.org/repos/asf/apr/apr/trunk srclib/apr"
+    echo ""
+    should_exit=1
+fi
+
+for dir in $apu_src_dir
+do
+    if [ -d "${dir}" -a -f "${dir}/Makefile.in" ]; then
+        echo "found apr-util source: ${dir}"
+        apu_src_dir=$dir
+        apu_found=1
+        break
+    fi
+done
+
+if [ $apu_found -lt 1 ]; then
+    echo ""
+    echo "You don't have a copy of the apr-util source in srclib/apr-util. "
+    echo "Please get one the source using the following instructions, "
+    echo "or specify the location of the source with "
+    echo "--with-apr-util=[path to apr-util]:"
+    echo ""
+    echo "   svn co http://svn.apache.org/repos/asf/apr/apr-util/trunk srclib/apr-util"
+    echo ""
+    should_exit=1
+fi
+
+if [ $should_exit -gt 0 ]; then
+    exit 1
+fi
+
+if [ ! -d build ]; then
+  $apr_src_dir/build/mkdir.sh build
+fi
+
+echo copying build files
+cp $apr_src_dir/build/config.guess $apr_src_dir/build/config.sub \
+   $apr_src_dir/build/install.sh $apr_src_dir/build/apr_common.m4 \
+   $apr_src_dir/build/find_apr.m4 $apu_src_dir/build/find_apu.m4 \
+   $apr_src_dir/build/get-version.sh build
+
+echo generating configure
+${AUTOCONF:-autoconf}
+
+# Remove autoconf 2.5x's cache directory
+rm -rf autom4te*.cache
+

Propchange: labs/dworker/trunk/buildconf
------------------------------------------------------------------------------
    svn:executable = 

Added: labs/dworker/trunk/config.layout
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/config.layout?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/config.layout (added)
+++ labs/dworker/trunk/config.layout Wed Dec  6 00:57:32 2006
@@ -0,0 +1,26 @@
+##
+##  config.layout -- Pre-defined Installation Path Layouts
+##
+##  Hints:
+##  - layouts can be loaded with configure's --enable-layout=ID option
+##  - when no --enable-layout option is given, the default layout is `serf'
+##  - a trailing plus character (`+') on paths is replaced with a 
+##    `/<target>' suffix where <target> is currently hardcoded to 'serf'.
+##    (This may become a configurable parameter at some point.)
+##
+
+<Layout DWORKER>
+    prefix:        /usr/local/dworker
+    exec_prefix:   ${prefix}
+    bindir:        ${exec_prefix}/bin
+    sbindir:       ${exec_prefix}/bin
+    libdir:        ${exec_prefix}/lib
+    libexecdir:    ${exec_prefix}/modules
+    mandir:        ${prefix}/man
+    sysconfdir:    ${prefix}/conf
+    datadir:       ${prefix}
+    installbuilddir: ${datadir}/build-${DW_MAJOR_VERSION}
+    includedir:    ${prefix}/include/dworker-${DW_MAJOR_VERSION}
+    localstatedir: ${prefix}
+    libsuffix:     -${DW_MAJOR_VERSION}
+</Layout>

Added: labs/dworker/trunk/configure.in
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/configure.in?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/configure.in (added)
+++ labs/dworker/trunk/configure.in Wed Dec  6 00:57:32 2006
@@ -0,0 +1,137 @@
+dnl Autoconf file for dworker
+
+AC_PREREQ(2.50)
+AC_INIT(server/dworker.c)
+
+AC_CONFIG_AUX_DIR(build)
+
+sinclude(build/apr_common.m4)
+sinclude(build/find_apr.m4)
+sinclude(build/find_apu.m4)
+
+AC_PREFIX_DEFAULT(/usr/local/dworker)
+
+dnl Get the layout here, so we can pass the required variables to apr
+APR_ENABLE_LAYOUT(DWORKER, [])
+
+dnl reparse the configure arguments.
+APR_PARSE_ARGUMENTS
+
+APR_CONFIG_NICE(config.nice)
+
+nl='
+'
+dnl Check that mkdir -p works
+APR_MKDIR_P_CHECK($top_srcdir/build/mkdir.sh)
+AC_SUBST(mkdir_p)
+
+AC_CANONICAL_SYSTEM
+
+orig_prefix="$prefix"
+
+echo $ac_n "${nl}Configuring Apache Portable Runtime library...${nl}"
+
+APR_FIND_APR("$srcdir/apr", "./apr", 1, 1)
+
+if test "$apr_found" = "no"; then
+  AC_MSG_ERROR([APR not found.  Please read the documentation.])
+fi
+
+if test "$apr_found" = "reconfig"; then
+  APR_SUBDIR_CONFIG(apr,
+                    [--prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir --datadir=$datadir --with-installbuilddir=$installbuilddir],
+                    [--enable-layout=*|\'--enable-layout=*])
+  dnl We must be the first to build and the last to be cleaned
+  DW_BUILD_SRCLIB_DIRS="apr $DW_BUILD_SRCLIB_DIRS"
+  DW_CLEAN_SRCLIB_DIRS="$DW_CLEAN_SRCLIB_DIRS apr"
+fi
+
+APR_SETIFNULL(CC, `$apr_config --cc`)
+APR_SETIFNULL(CPP, `$apr_config --cpp`)
+APR_SETIFNULL(APR_LIBTOOL, `$apr_config --apr-libtool`)
+APR_ADDTO(CFLAGS, `$apr_config --cflags`)
+APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
+APR_ADDTO(LDFLAGS, `$apr_config --ldflags`)
+SHLIBPATH_VAR=`$apr_config --shlib-path-var`
+APR_BINDIR=`$apr_config --bindir`
+APR_INCLUDEDIR=`$apr_config --includedir`
+APR_VERSION=`$apr_config --version`
+APR_CONFIG="$apr_config"
+
+AC_SUBST(APR_LIBTOOL)
+AC_SUBST(APR_BINDIR)
+AC_SUBST(APR_INCLUDEDIR)
+AC_SUBST(APR_VERSION)
+AC_SUBST(APR_CONFIG)
+
+echo $ac_n "${nl}Configuring Apache Portable Runtime Utility library...${nl}"
+
+APR_FIND_APU("$srcdir/apr-util", "./apr-util", 1, 1)
+
+if test "$apu_found" = "no"; then
+  AC_MSG_ERROR([APR-util not found.  Please read the documentation.])
+fi
+
+# Catch some misconfigurations:
+case ${apr_found}.${apu_found} in
+reconfig.yes)
+  AC_MSG_ERROR([Cannot use an external APR-util with the bundled APR])
+  ;;
+yes.reconfig)
+  AC_MSG_ERROR([Cannot use an external APR with the bundled APR-util])
+  ;;
+esac  
+
+if test "$apu_found" = "reconfig"; then
+  APR_SUBDIR_CONFIG(apr-util,
+                    [--with-apr=../apr --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir],
+                    [--enable-layout=*|\'--enable-layout=*])
+  dnl We must be the last to build and the first to be cleaned
+  DW_BUILD_SRCLIB_DIRS="$DW_BUILD_SRCLIB_DIRS apr-util"
+  DW_CLEAN_SRCLIB_DIRS="apr-util $DW_CLEAN_SRCLIB_DIRS"
+fi
+
+APR_ADDTO(LDFLAGS, `$apu_config --ldflags`)
+APU_BINDIR=`$apu_config --bindir`
+APU_INCLUDEDIR=`$apu_config --includedir`
+APU_VERSION=`$apu_config --version`
+APU_CONFIG="$APU_BINDIR/apu-`echo ${APU_VERSION} | sed 's,\..*,,'`-config"
+
+AC_SUBST(APU_BINDIR)
+AC_SUBST(APU_INCLUDEDIR)
+AC_SUBST(APU_VERSION)
+AC_SUBST(APU_CONFIG)
+
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+
+echo $ac_n "${nl}Configuring dworker...${nl}"
+
+dnl Absolute source/build directory
+abs_srcdir=`(cd $srcdir && pwd)`
+abs_builddir=`pwd`
+
+dnl get our version information
+get_version="$abs_srcdir/build/get-version.sh"
+version_hdr="$abs_srcdir/include/dw_version.h"
+DW_MAJOR_VERSION="`$get_version major $version_hdr DW`"
+DW_DOTTED_VERSION="`$get_version all $version_hdr DW`"
+
+APR_ADDTO(CFLAGS, [-g])
+APR_ADDTO(CFLAGS, [-Wall])
+APR_ADDTO(CFLAGS, [-Werror])
+
+AC_SUBST(DW_MAJOR_VERSION)
+AC_SUBST(DW_DOTTED_VERSION)
+
+AC_SUBST(DW_BUILD_SRCLIB_DIRS)
+AC_SUBST(DW_CLEAN_SRCLIB_DIRS)
+
+libs="`$apu_config --link-libtool --libs` `$apr_config --link-libtool --libs`"
+APR_ADDTO(DW_LIBS, [$libs])
+AC_SUBST(DW_LIBS)
+
+AC_CONFIG_FILES([Makefile])
+
+AC_OUTPUT

Added: labs/dworker/trunk/doap.rdf
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/doap.rdf?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/doap.rdf (added)
+++ labs/dworker/trunk/doap.rdf Wed Dec  6 00:57:32 2006
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+         xmlns="http://usefulinc.com/ns/doap#"
+         xmlns:foaf="http://xmlns.com/foaf/0.1/"
+         xmlns:labs="http://labs.apache.org/doap-ext/1.0#"
+         xmlns:projects="http://projects.apache.org/ns/asfext#">
+
+<Project rdf:about="http://labs.apache.org/labs#dworker">
+    <name>dworker</name>
+    <shortname>dworker</shortname>
+    <shortdesc xml:lang="en">Distributed low latency jobs system in C</shortdesc>
+    <description xml:lang="en">dworker provides a scalable system to execute many tasks in parallel with a bent towards executing them in as low latency as possible. The primary target is generating content for web sites, by parallelizing the generation of the page's resources as much as possible. </description>
+    <homepage rdf:resource="http://labs.apache.org/dworker/"/>
+    <license rdf:resource="http://usefulinc.com/doap/licenses/asl20"/>
+    <created>2006-12-2</created>
+    <labs:status>active</labs:status>
+    <maintainer>
+        <foaf:Person rdf:about="http://people.apache.org/~pquerna/#me"> 
+            <foaf:name>Paul Querna</foaf:name>
+            <foaf:homepage rdf:resource="http://people.apache.org/~pquerna/"/>
+            <foaf:mbox_sha1sum>99ff0648fcc8787b5efc5c561fbc19206d7ec6ae</foaf:mbox_sha1sum>
+        </foaf:Person>
+    </maintainer>
+    <repository>
+        <SVNRepository>
+            <location rdf:resource="http://svn.apache.org/repos/asf/labs/dworker/"/>
+            <browse rdf:resource="http://svn.apache.org/viewvc/labs/dworker/"/>
+       </SVNRepository>
+    </repository>
+    <programming-language>c</programming-language>
+</Project>
+</rdf:RDF> 
+

Added: labs/dworker/trunk/include/dw_version.h
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/include/dw_version.h?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/include/dw_version.h (added)
+++ labs/dworker/trunk/include/dw_version.h Wed Dec  6 00:57:32 2006
@@ -0,0 +1,53 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/**
+ * @file dw_version.h
+ * @brief Defines the dworker version information.
+ */
+
+#ifndef _DW_VERSION_H_
+#define _DW_VERSION_H_
+
+#include "apr_general.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+    
+    
+#define DW_MAJOR_VERSION 0
+#define DW_MINOR_VERSION 1
+#define DW_PATCH_VERSION 0
+
+#define DW_DEVBUILD_BOOLEAN 1
+
+#if DW_DEVBUILD_BOOLEAN
+#define DW_VER_ADD_STRING "-dev"
+#else
+#define DW_VER_ADD_STRING "-release"
+#endif
+
+#define DW_VERSION_STRING  APR_STRINGIFY(DW_MAJOR_VERSION) "." \
+                            APR_STRINGIFY(DW_MINOR_VERSION) "." \
+                            APR_STRINGIFY(DW_PATCH_VERSION) \
+                            DW_VER_ADD_STRING
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _DW_VERSION_H_ */

Propchange: labs/dworker/trunk/include/dw_version.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: labs/dworker/trunk/include/dworker.h
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/include/dworker.h?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/include/dworker.h (added)
+++ labs/dworker/trunk/include/dworker.h Wed Dec  6 00:57:32 2006
@@ -0,0 +1,85 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/**
+ * @file dworker.h
+ * @brief provides public interface for dworker modules.
+ */
+
+#ifndef _DWORKER_H_
+#define _DWORKER_H_
+
+#include "dw_version.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct dw_ctxt_t dw_ctxt_t;
+typedef struct dw_req_t dw_req_t;
+
+typedef struct dw_module_struct dw_module_t;
+
+typedef void (*dw_module_register_cb)(dw_ctxt_t *dwc, dw_module_t *dmod);
+
+struct dw_module_struct {
+    /** Used to check the module's version number is compatible 
+     *  with dworker's current version.
+     */
+    int version;
+    
+    /** @private : Internal DSO handle for this module. */
+    void *dso_handle;
+        
+    /** __FILE__ from the module */
+    const char *name;
+
+    dw_module_register_cb register_func;
+};
+
+/**
+ * We only have a single level Module Magic Number, 
+ * Unlike httpd, which is a two level, with compat stuff. meh. */
+#define DW_MODULE_VERSION 0x00000001
+
+#define DW_STANDARD_MODULE_STUFF \
+            DW_MODULE_VERSION,   \
+            NULL,                \
+            __FILE__
+
+#define DW_MODULE_DECL(modname, regfunc) \
+    dw_module_t dw_ ## modname ## _module =     \
+    {                                    \
+        DW_STANDARD_MODULE_STUFF,        \
+        regfunc                          \
+    };
+
+typedef int(*dw_handler_cb)(dw_req_t* dwr, char *param,
+                            apr_size_t len, void* baton);
+
+apr_status_t dw_req_send_result(dw_req_t *dwr,
+                                const char *data, apr_size_t len);
+
+void dw_register_handler(dw_ctxt_t *dwc, dw_module_t *mod, const char *cmd,
+                         dw_handler_cb func_cp, void *baton);
+
+dw_ctxt_t *dw_req_get_context(dw_req_t *pwr);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _DWORKER_H_ */

Propchange: labs/dworker/trunk/include/dworker.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: labs/dworker/trunk/server/dw_example.c
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/server/dw_example.c?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/server/dw_example.c (added)
+++ labs/dworker/trunk/server/dw_example.c Wed Dec  6 00:57:32 2006
@@ -0,0 +1,55 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include "dworker.h"
+#include <stdio.h>
+#include "apr_strings.h"
+
+static int handler_example_add(dw_req_t* dwr, char* data, apr_size_t len, void* baton)
+{
+    char reply[128];
+    int a = 0;
+    int b = 0;
+    int rv = 0;
+ 
+    /* XXXXX: error logging */
+    if (len < 1) {
+        return -1;
+    }
+    
+    rv = sscanf(data, "%d,%d", &a, &b);
+    fprintf(stderr, "input: %s ==  %d+%d\n", data, a, b);
+
+    /* XXXXX: error logging */
+    if (rv != 2) {
+        return -1;
+    }
+
+    rv = a+b;
+    len = apr_snprintf(reply, sizeof(reply), "%d", rv);
+    
+    fprintf(stderr, "sending: %s\n", reply);
+    dw_req_send_result(dwr, reply, len);
+    
+    return 0;
+}
+
+static void register_example(dw_ctxt_t *dwc, dw_module_t *dmod)
+{
+    dw_register_handler(dwc, dmod, "EX_ADD", handler_example_add, NULL);    
+}
+
+DW_MODULE_DECL(example, register_example);
\ No newline at end of file

Propchange: labs/dworker/trunk/server/dw_example.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: labs/dworker/trunk/server/dworker.c
URL: http://svn.apache.org/viewvc/labs/dworker/trunk/server/dworker.c?view=auto&rev=482974
==============================================================================
--- labs/dworker/trunk/server/dworker.c (added)
+++ labs/dworker/trunk/server/dworker.c Wed Dec  6 00:57:32 2006
@@ -0,0 +1,899 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "dworker.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <libgen.h>
+
+#include <apr.h>
+#include <apr_dso.h>
+#include <apr_hash.h>
+#include <apr_strings.h>
+#include <apr_fnmatch.h>
+#include <apr_file_io.h>
+#include <apr_signal.h>
+#include <apr_network_io.h>
+#include <apr_thread_mutex.h>
+#include <apr_thread_proc.h>
+#include <apr_buckets.h>
+
+typedef struct dw_conf_t {
+    const char *modules_path;
+    const char *addr;
+    int port;
+    int threads;
+    int verbose;
+} dw_conf_t;
+
+/* signle worker thread */
+typedef struct dw_worker_t  dw_worker_t;
+struct dw_worker_t {
+    apr_thread_t *m_thread;
+    apr_pool_t *m_pool;
+    dw_ctxt_t *m_ctxt;
+    dw_worker_t *next;
+};
+
+typedef struct dw_module_list_t  dw_module_list_t;
+
+struct dw_module_list_t {
+    dw_module_t *m_module;
+    dw_module_list_t *next;
+};
+
+struct dw_ctxt_t {
+    apr_pool_t *m_pool;
+    dw_conf_t m_conf;
+    apr_hash_t *m_plugins;
+    apr_file_t *errfile;
+    apr_file_t *outfile;
+    
+    /* listening socket */
+    apr_socket_t *m_lskt;
+    /* only a single thread controlls the listening socket at a time. */
+    apr_thread_mutex_t *m_lmutex;
+    
+    /* linked list of worker threads. */
+    dw_worker_t *m_threads;
+    
+    /* linked list of all loaded module handles */
+    dw_module_list_t *m_modules;
+    
+    /* 0=stop, 1=continue */
+    int m_keep_running;
+};
+
+typedef struct dw_stats_t {
+    apr_uint64_t requests;
+    apr_uint64_t bytes;
+} dw_stats_t;
+
+typedef struct dw_plugin_t {
+    dw_stats_t m_stats;
+    dw_module_t *m_module;
+    const char* m_name;
+    dw_handler_cb m_cb;
+    void *m_baton;
+} dw_plugin_t;
+
+struct dw_req_t {
+    apr_socket_t *m_skt;
+    apr_bucket_alloc_t *m_bballoc;
+    apr_bucket_brigade *m_bbin;
+    apr_bucket_brigade *m_bbtmp;
+};
+
+#ifndef AP_IOBUFSIZE
+#define AP_IOBUFSIZE 8192
+#endif
+
+
+#define DW_EOL "\r\n"
+#define DW_EOL_LEN (sizeof(DW_EOL)-1)
+
+#define DW_WS " "
+#define DW_WS_LEN (sizeof(DW_WS)-1)
+
+#define DW_INVOKE "invoke "
+#define DW_INVOKE_LEN (sizeof(DW_INVOKE)-1)
+
+#define DW_STATS "stats"
+#define DW_STATS_LEN (sizeof(DW_STATS)-1)
+
+#define DW_MAX_PARAM_LEN 524288 /* 512 kbytes */
+
+static apr_status_t dw_write_error(dw_ctxt_t *ctxt, dw_req_t *req,
+                                   const char* message)
+{
+    apr_file_printf(ctxt->errfile,
+                    "Client Error: %s\n",
+                    message);
+    /* XXXX: Send ERR: to client. */
+    return APR_SUCCESS;
+}
+
+apr_status_t dw_req_send_result(dw_req_t *req, const char *data, apr_size_t len)
+{
+    apr_status_t rv;
+    char tbuf[128];
+    apr_size_t buflen;
+    
+    buflen = apr_snprintf(tbuf, sizeof(tbuf),
+                          "RESULT %" APR_SIZE_T_FMT "\r\n", len);
+    
+    rv = apr_socket_send(req->m_skt, tbuf, &buflen);
+    
+    if (rv) {
+        return rv;
+    }
+
+    buflen = len;
+    rv = apr_socket_send(req->m_skt, data, &buflen);
+    if (rv) {
+        return rv;
+    }
+    
+    buflen = apr_snprintf(tbuf, sizeof(tbuf), "\r\nEND\r\n");
+    rv = apr_socket_send(req->m_skt, tbuf, &buflen);
+    if (rv) {
+        return rv;
+    }
+
+    return rv;
+}
+
+static apr_status_t dw_handle_command_param(dw_ctxt_t *ctxt, dw_req_t *req,
+                                            int len,
+                                            char **obuf, apr_size_t *oblen,
+                                            apr_pool_t *pool)
+{
+    apr_size_t blen = 0;
+    char *buf = NULL;
+    apr_status_t rv = APR_SUCCESS;
+    
+
+    if (ctxt->m_conf.verbose) {
+        apr_file_printf(ctxt->errfile,
+                        "command param len: %d\n",
+                        len);        
+    }
+
+    if (len == 0) {
+        /* XXXX: no input to read */
+    }
+    else if (len < 0) {
+        /* < -1 is a shortcut to search for the next newline */
+        do {
+            rv = apr_brigade_split_line(req->m_bbtmp, req->m_bbin,
+                                        APR_BLOCK_READ, AP_IOBUFSIZE);
+        } while (APR_STATUS_IS_EAGAIN(rv));
+        
+        if (rv) {
+            apr_file_printf(ctxt->errfile,
+                            "Error: Reading line from client: (%d) %pm\n",
+                            rv, &rv);
+            return rv;
+        }
+        
+        rv = apr_brigade_pflatten(req->m_bbtmp, &buf, &blen, pool);
+        apr_brigade_cleanup(req->m_bbtmp);
+
+        if (rv) {
+            apr_file_printf(ctxt->errfile,
+                            "Error: Reading pflatten from client: (%d) %pm\n",
+                            rv, &rv);
+            return rv;
+        }
+    }
+    else if (len > DW_MAX_PARAM_LEN) {
+        return dw_write_error(ctxt, req, "requested parameter size is too large.");
+    }
+    else {
+        apr_bucket *f = NULL;
+        apr_bucket *e = NULL;
+        
+        do {
+            rv = apr_brigade_partition(req->m_bbin, len, &e);
+        } while (APR_STATUS_IS_EAGAIN(rv));
+        
+        if (rv) {
+            apr_file_printf(ctxt->errfile,
+                            "Error: Reading line from client: (%d) %pm\n",
+                            rv, &rv);
+            return rv;
+        }
+        
+        if (!e) {
+            apr_file_printf(ctxt->errfile,
+                            "Error: No bucket reading line from client: (%d) %pm\n",
+                            rv, &rv);
+            return rv;
+        }
+        
+        /* XXXX: apr_brigade_split sucks, makes you allocate a new brigade. */
+        if (e != APR_BRIGADE_SENTINEL(req->m_bbin)) {
+            f = APR_RING_LAST(&req->m_bbin->list);
+            APR_RING_UNSPLICE(e, f, link);
+            APR_RING_SPLICE_HEAD(&req->m_bbtmp->list, e, f, apr_bucket, link);
+        }
+        else {
+            apr_brigade_cleanup(req->m_bbtmp);
+        }
+        
+        rv = apr_brigade_pflatten(req->m_bbtmp, &buf, &blen, pool);
+        apr_brigade_cleanup(req->m_bbtmp);
+        
+        if (rv) {
+            apr_file_printf(ctxt->errfile,
+                            "Error: Reading pflatten from client: (%d) %pm\n",
+                            rv, &rv);
+            return rv;
+        }
+    }
+    
+    *obuf = buf;
+    *oblen = blen;
+    
+    return rv;
+}
+
+static apr_status_t dw_handle_invoke(dw_ctxt_t *ctxt, dw_req_t *req,
+                                     char* buf, apr_size_t blen, apr_pool_t *pool)
+{
+    int ret = 0;
+    apr_status_t rv = APR_SUCCESS;
+    char *cmdbuf = NULL;
+    apr_size_t cmdlen = 0;
+    char *p = buf;
+    const char *command = NULL;
+    int plen = 0;
+    char *pws;
+
+    p += DW_INVOKE_LEN;
+    
+    pws = strchr(p, ' ');
+    
+    if (pws) {
+        command = apr_pstrndup(pool, p, (pws - p));
+        p += (pws - p);
+        pws = strchr(p, ' ');
+        if (pws) {
+            plen = atoi(pws);
+            rv = dw_handle_command_param(ctxt, req, plen, &cmdbuf, &cmdlen, pool);
+            if (rv) {
+                return rv;
+            }
+            
+            {
+                dw_plugin_t *plugin = apr_hash_get(ctxt->m_plugins, command, APR_HASH_KEY_STRING);
+                if (!plugin) {
+                    apr_file_printf(ctxt->errfile,
+                                    "Error: client command: %s\n",
+                                    command);                    
+                    return dw_write_error(ctxt, req, "no such task to invoke");
+                }
+                
+                ret = plugin->m_cb(req, cmdbuf, cmdlen, plugin->m_baton);
+            }
+        }
+        else {
+            return dw_write_error(ctxt, req, "invalid invoke parameters");
+        }
+    }
+    else {
+        return dw_write_error(ctxt, req, "invalid invoke parameters");
+    }
+    
+    return rv;
+}
+
+static apr_status_t dw_handle_line(dw_ctxt_t *ctxt, dw_req_t *req, 
+                                   char* buf, apr_size_t blen, apr_pool_t *pool)
+{
+    char *p = buf;
+
+    if (strncmp(DW_INVOKE, p, DW_INVOKE_LEN) == 0) {
+        return dw_handle_invoke(ctxt, req, buf, blen, pool);
+    }
+    else {
+        return dw_write_error(ctxt, req, "invalid command");
+    }
+    
+    return APR_SUCCESS;
+}
+
+static apr_status_t dw_handle_client(dw_ctxt_t *ctxt, dw_worker_t *me, 
+                                     dw_req_t *req, apr_pool_t *conn_pool)
+{
+    apr_status_t rv = APR_SUCCESS;
+    apr_pool_t *tpool = NULL;
+    apr_pool_create(&tpool, conn_pool);
+    
+    do {
+        char buf[AP_IOBUFSIZE];
+        apr_size_t blen = sizeof(buf) - 1;
+        
+        apr_pool_clear(tpool);
+
+        do {
+            rv = apr_brigade_split_line(req->m_bbtmp, req->m_bbin,
+                                        APR_BLOCK_READ, blen);
+        } while (APR_STATUS_IS_EAGAIN(rv));
+        
+        if (rv) {
+            apr_file_printf(ctxt->errfile,
+                            "Error: Reading line from client: (%d) %pm\n",
+                            rv, &rv);
+            break;
+        }
+        
+        rv = apr_brigade_flatten(req->m_bbtmp, buf, &blen);
+        apr_brigade_cleanup(req->m_bbtmp);
+
+        if (blen > 0) {
+            buf[blen] = '\0';
+            dw_handle_line(ctxt, req, buf, blen, tpool);
+        }
+        else {
+            rv = APR_EGENERAL;
+            apr_file_printf(ctxt->errfile,
+                            "Error: Reading line from client: (%d) %pm\n",
+                            rv, &rv);
+            break;
+        }
+    } while (rv == APR_SUCCESS);
+
+    apr_pool_destroy(tpool);
+
+    return rv;
+}
+
+static apr_status_t dw_get_client(dw_ctxt_t *ctxt, dw_req_t **p_req, 
+                                  apr_pool_t *p)
+{
+    apr_status_t rv;
+    apr_socket_t *skt;
+    dw_req_t *req;
+    apr_bucket* bsock;
+    
+    apr_thread_mutex_lock(ctxt->m_lmutex);
+    
+    rv = apr_socket_accept(&skt, ctxt->m_lskt, p);
+    
+    if (rv) {
+        apr_thread_mutex_unlock(ctxt->m_lmutex);
+        apr_file_printf(ctxt->errfile,
+                        "Error: Socket Accept Failed: (%d) %pm\n",
+                        rv, &rv);        
+        return rv;
+    }
+    apr_thread_mutex_unlock(ctxt->m_lmutex);
+    
+    req = apr_palloc(p, sizeof(dw_req_t));
+    req->m_skt = skt;
+    req->m_bballoc = apr_bucket_alloc_create(p);
+    req->m_bbin = apr_brigade_create(p, req->m_bballoc);
+    req->m_bbtmp = apr_brigade_create(p, req->m_bballoc);
+    bsock = apr_bucket_socket_create(req->m_skt, req->m_bballoc);
+    APR_BRIGADE_INSERT_TAIL(req->m_bbin, bsock);
+    
+    *p_req = req;
+    return APR_SUCCESS;
+}
+
+static void* dw_worker_thread(apr_thread_t *p_thread, void *p_baton)
+{
+    apr_status_t rv = APR_SUCCESS;
+    dw_worker_t *me = p_baton;
+    dw_ctxt_t *ctxt = me->m_ctxt;
+    me->m_pool = apr_thread_pool_get(me->m_thread);
+
+    apr_pool_t *tpool = NULL;
+    apr_pool_create(&tpool, me->m_pool);
+    
+    while (ctxt->m_keep_running == 1) {
+        dw_req_t *req = NULL;
+        
+        rv = dw_get_client(ctxt, &req, tpool);
+
+        if (rv) {
+            apr_pool_clear(tpool);
+            continue;
+        }
+
+        if (ctxt->m_conf.verbose) {
+            apr_file_printf(ctxt->outfile, "connection open\n");
+        }
+        
+        rv = dw_handle_client(ctxt, me, req, tpool);
+        
+        if (ctxt->m_conf.verbose) {
+            apr_file_printf(ctxt->outfile, "connection close\n");
+        }
+        
+        if (rv) {
+            apr_file_printf(ctxt->errfile,
+                            "Error: handle client returned: (%d) %pm\n",
+                            rv, &rv);
+            apr_pool_clear(tpool);
+            continue;
+        }
+        
+        apr_pool_clear(tpool);
+    }
+
+    if (ctxt->m_conf.verbose) {
+        apr_file_printf(ctxt->outfile, "Thread exiting.\n");
+    }
+    
+    return NULL;
+}
+
+void dw_register_handler(dw_ctxt_t *ctxt, dw_module_t *pmod,
+                         const char *cmd,
+                         dw_handler_cb func_cp, void *baton)
+{
+    dw_plugin_t *plugin = apr_palloc(ctxt->m_pool, sizeof(dw_plugin_t));
+    
+    plugin->m_stats.requests = 0;
+    plugin->m_stats.bytes = 0;
+    plugin->m_module = pmod;
+    plugin->m_name = apr_pstrdup(ctxt->m_pool, cmd);
+    plugin->m_cb = func_cp;
+    plugin->m_baton = baton;
+    
+    if (ctxt->m_conf.verbose) {
+        apr_file_printf(ctxt->outfile, "\tRegistered Handler: %s\n", plugin->m_name);
+    }
+    
+    apr_hash_set(ctxt->m_plugins, plugin->m_name, APR_HASH_KEY_STRING, plugin);
+}
+
+static void dw_add_module(dw_ctxt_t* ctxt, dw_module_list_t *ml)
+{
+    dw_module_list_t *last = NULL;
+    dw_module_list_t *cur = ctxt->m_modules;
+
+    ml->next = NULL;
+
+    if (!cur) {
+        ctxt->m_modules = ml;
+        return;
+    }
+    
+    while (cur) {
+        last = cur;
+        cur = cur->next;
+    }
+    
+    last->next = ml;
+}
+
+static apr_status_t dw_load_module(dw_ctxt_t* ctxt, const char* file)
+{
+    apr_dso_handle_t *handle;
+    apr_dso_handle_sym_t symbol;
+    apr_status_t rv;
+    char *module_name, *t;
+    dw_module_t *module;
+    dw_module_list_t *ml;
+    
+    rv = apr_dso_load(&handle, file, ctxt->m_pool);
+    if (rv) {
+        return rv;
+    }
+    
+    /* figure out the module name */
+    module_name = apr_pstrdup(ctxt->m_pool, basename(file));
+    if ((t = strrchr(module_name, '.'))) {
+        *t = '\0';
+    }
+    
+    /* load the module info */
+    t = apr_psprintf(ctxt->m_pool, "%s_module", module_name);
+    rv = apr_dso_sym(&symbol, handle, t);
+    if (rv) {
+        return rv;
+    }
+    
+    module = (dw_module_t*) symbol;
+    if (module->version != DW_MODULE_VERSION) {
+        /* magic byte mismatch, bail bail bail!*/
+        apr_file_printf(ctxt->errfile,
+                        "Error: '%s' contained an invalid version number. Found: %d Expected: %d\n",
+                        file, module->version, DW_MODULE_VERSION);
+        
+        return APR_EGENERAL;
+    }
+    module->dso_handle = handle;
+    ml = apr_palloc(ctxt->m_pool, sizeof(dw_module_list_t));
+
+    dw_add_module(ctxt, ml);
+    
+    module->register_func(ctxt, module);
+
+    return APR_SUCCESS;    
+}
+
+/*  load user generated tasklets. */
+static apr_status_t dw_load_modules(dw_ctxt_t* ctxt)
+{
+    int i;
+    apr_status_t rv = APR_SUCCESS;
+    apr_pool_t *tpool;
+    apr_array_header_t *results;
+    const char *pattern;
+    char **entry;
+    
+    apr_pool_create(&tpool, ctxt->m_pool);
+    
+    rv = apr_filepath_set(ctxt->m_conf.modules_path, ctxt->m_pool);
+    if (rv) {
+        apr_file_printf(ctxt->errfile,
+                        "Error: Unable to chdir into '%s': (%d) %pm\n",
+                        ctxt->m_conf.modules_path,
+                        rv, &rv);
+        apr_pool_destroy(tpool);
+        return rv;
+    }
+    
+    pattern = apr_pstrcat(tpool, ctxt->m_conf.modules_path, "/dw_*.so", NULL);
+
+    rv = apr_match_glob(pattern, &results, tpool);
+    
+    if (rv) {
+        apr_file_printf(ctxt->errfile,
+                        "Error: Glob Pattern Failed, %s: (%d) %pm\n", pattern,
+                        rv, &rv);
+        apr_pool_destroy(tpool);
+        return rv;
+    }
+    
+    if (results->nelts < 1) {
+        apr_file_printf(ctxt->errfile,
+                        "Error: No Modules found at %s\n", pattern);
+        apr_pool_destroy(tpool);
+        return APR_ENOSTAT;
+    }
+
+    entry = (char **)results->elts;
+    for (i = 0; i < results->nelts; i++) {
+        char *file = entry[i];
+        if (ctxt->m_conf.verbose) {
+            apr_file_printf(ctxt->outfile, "Loading Module: %s\n", file);
+        }
+        
+        rv = dw_load_module(ctxt, file);
+
+        if (rv) {
+            apr_file_printf(ctxt->errfile,
+                            "Error: Unable to load module %s: (%d) %pm\n", file,
+                            rv, &rv);
+            apr_pool_destroy(tpool);
+            return rv;
+        }
+    }
+    
+    
+    apr_pool_destroy(tpool);
+    return rv;   
+}
+
+/* start io / listening socket. */
+static apr_status_t dw_start_io(dw_ctxt_t* ctxt)
+{
+    apr_status_t rv = APR_SUCCESS;
+    apr_sockaddr_t *saddr;
+    
+    rv = apr_socket_create(&ctxt->m_lskt, APR_INET, SOCK_STREAM, APR_PROTO_TCP,
+                           ctxt->m_pool);
+    if (rv) {
+        apr_file_printf(ctxt->errfile,
+                        "Error: Unable to create listening socket: (%d) %pm\n",
+                        rv, &rv);
+        return rv;
+    }
+
+    rv = apr_socket_opt_set(ctxt->m_lskt, APR_SO_NONBLOCK, 0);
+    if (rv) {
+        apr_file_printf(ctxt->errfile,
+                        "Error: Unable to configure socket as blocking: (%d) %pm\n",
+                        rv, &rv);
+        return rv;
+    }
+
+    rv = apr_socket_opt_set(ctxt->m_lskt, APR_SO_REUSEADDR, 1);
+    if (rv) {
+        apr_file_printf(ctxt->errfile,
+                        "Error: Unable to configure socket as reuseaddr: (%d) %pm\n",
+                        rv, &rv);
+        return rv;
+    }
+    
+    rv = apr_sockaddr_info_get(&saddr, ctxt->m_conf.addr,
+                               APR_UNSPEC, ctxt->m_conf.port, 0,
+                               ctxt->m_pool);
+    if (rv) {
+        apr_file_printf(ctxt->errfile,
+                        "Error: Unable to get sockaddr for %s:%d: (%d) %pm\n",
+                        ctxt->m_conf.addr, ctxt->m_conf.port,
+                        rv, &rv);
+        return rv;
+    }
+    
+    rv = apr_socket_bind(ctxt->m_lskt, saddr);
+
+    if (rv) {
+        apr_file_printf(ctxt->errfile,
+                        "Error: Unable to bind listening socket to %s:%d: (%d) %pm\n",
+                        ctxt->m_conf.addr, ctxt->m_conf.port,
+                        rv, &rv);
+        return rv;
+    }
+    
+    rv = apr_socket_listen(ctxt->m_lskt, 5);
+
+    if (rv) {
+        apr_file_printf(ctxt->errfile,
+                        "Error: Unable to enable listen socket on %s:%d: (%d) %pm\n",
+                        ctxt->m_conf.addr, ctxt->m_conf.port,
+                        rv, &rv);
+        return rv;
+    }
+
+    rv = apr_thread_mutex_create(&ctxt->m_lmutex, APR_THREAD_MUTEX_DEFAULT,
+                            ctxt->m_pool);
+
+    if (rv) {
+        apr_file_printf(ctxt->errfile,
+                        "Error: Unable to create accept mutex: (%d) %pm\n",
+                        rv, &rv);
+        return rv;
+    }
+    
+    return rv;
+}
+
+/* startup all worker threads */
+static apr_status_t dw_start_threads(dw_ctxt_t* ctxt)
+{
+    apr_status_t rv = APR_SUCCESS;
+    int i;
+    dw_worker_t *last = NULL;
+    dw_worker_t *cur = NULL;
+    
+    for (i = 0; i < ctxt->m_conf.threads; i++) {
+        cur = apr_palloc(ctxt->m_pool, sizeof(dw_worker_t));
+        
+        cur->m_ctxt = ctxt;
+        cur->next = last;
+        last = cur;
+
+        if (!ctxt->m_threads) {
+            ctxt->m_threads = cur;
+        }
+        
+        if (ctxt->m_conf.verbose) {
+            apr_file_printf(ctxt->outfile, "Spawning Thread #%d\n", i);
+        }
+        
+        rv = apr_thread_create(&cur->m_thread, NULL,
+                               dw_worker_thread, cur, ctxt->m_pool);
+        
+        if (rv) {
+            apr_file_printf(ctxt->errfile,
+                            "Error: unable to spawn thread: (%d) %pm\n", rv,
+                            &rv);
+            return rv;
+        }
+    }
+    
+    return APR_SUCCESS;
+}
+
+/* waits for all threads to finish. */
+static apr_status_t dw_join_threads(dw_ctxt_t* ctxt)
+{
+    apr_status_t rv = APR_SUCCESS;
+    
+    dw_worker_t *cur = ctxt->m_threads;
+    while (cur) {
+        apr_status_t ret = APR_SUCCESS;
+        rv = apr_thread_join(&ret, cur->m_thread);
+
+        if (rv) {
+            apr_file_printf(ctxt->errfile,
+                            "Error: Unable to join worker thread: (%d) %pm\n",
+                            rv, &rv);            
+        }
+        cur = cur->next;
+    }
+    
+    return rv;
+}
+
+static dw_ctxt_t* dw___global_ctxt = NULL;
+
+static void dw_shutdown_sig(int signum)
+{
+    if (dw___global_ctxt) {
+        dw___global_ctxt->m_keep_running = 0;
+    }
+}
+
+static apr_status_t dw_setup_signals(dw_ctxt_t* ctxt)
+{
+    dw___global_ctxt = ctxt;
+    // XXXXX: need to break client out of the blocking accept().
+    // maybe switch to a pollset() on the listening socket?
+    // apr_signal(SIGINT, dw_shutdown_sig);
+    apr_signal(SIGHUP, dw_shutdown_sig);
+    return APR_SUCCESS;
+}
+
+static int dw_run(dw_ctxt_t* ctxt)
+{
+    apr_status_t rv = APR_SUCCESS;
+    
+    rv = dw_setup_signals(ctxt);
+    if (rv) {
+        return EXIT_FAILURE;
+    }
+    
+    rv = dw_load_modules(ctxt);
+    if (rv) {
+        return EXIT_FAILURE;
+    }
+
+    rv = dw_start_io(ctxt);
+    if (rv) {
+        return EXIT_FAILURE;
+    }
+
+    rv = dw_start_threads(ctxt);
+    if (rv) {
+        return EXIT_FAILURE;
+    }
+    
+    rv = dw_join_threads(ctxt);
+    if (rv) {
+        return EXIT_FAILURE;
+    }
+    
+    return EXIT_SUCCESS;
+}
+
+static void dw_create_context(apr_pool_t *p, dw_ctxt_t **p_ctxt)
+{
+    dw_ctxt_t* ctxt;
+
+    ctxt = apr_palloc(p, sizeof(dw_ctxt_t));
+    
+    ctxt->m_pool = p;
+    apr_file_open_stderr(&ctxt->errfile, ctxt->m_pool);
+    apr_file_open_stdout(&ctxt->outfile, ctxt->m_pool);
+    ctxt->m_threads = NULL;
+    ctxt->m_modules = NULL;
+    ctxt->m_plugins = apr_hash_make(ctxt->m_pool);
+    ctxt->m_keep_running = 1;
+    
+    ctxt->m_conf.modules_path = NULL;
+    ctxt->m_conf.addr = "0.0.0.0";
+    ctxt->m_conf.port = 11310;
+    ctxt->m_conf.threads = 50;
+    ctxt->m_conf.verbose = 0;
+    
+    *p_ctxt = ctxt;
+}
+
+static void dw_show_usage(dw_ctxt_t *ctxt)
+{
+    apr_file_printf(ctxt->errfile, 
+                    "dworker " DW_VERSION_STRING "\n");
+    apr_file_printf(ctxt->errfile, 
+                    "usage: dworker [options]\n");
+    apr_file_printf(ctxt->errfile, 
+                    "\n");
+    apr_file_printf(ctxt->errfile, 
+                    "--addr       Set the IP address to bind to. Default: 0.0.0.0\n");
+    apr_file_printf(ctxt->errfile, 
+                    "--port       Set the port to bind to. Default: 11310\n");
+    apr_file_printf(ctxt->errfile, 
+                    "--threads    Set the number of worker threads. Default: 50\n");
+    apr_file_printf(ctxt->errfile, 
+                    "\n");
+    apr_file_printf(ctxt->errfile, 
+                    "--modules    Set the path for modules to load.\n");
+    apr_file_printf(ctxt->errfile, 
+                    "\n");
+    apr_file_printf(ctxt->errfile, 
+                    "--help       Display this screen and exit.\n");
+    apr_file_printf(ctxt->errfile, 
+                    "--version    Display version and exit.\n");
+    apr_file_printf(ctxt->errfile, 
+                    "--verbose    Display extra details while running\n");
+    apr_file_printf(ctxt->errfile, 
+                    "\n");
+    exit(EXIT_FAILURE);
+}
+
+static void dw_show_version(dw_ctxt_t *ctxt)
+{
+    apr_file_printf(ctxt->outfile, 
+                    "dworker " DW_VERSION_STRING "\n");
+    exit(EXIT_SUCCESS);    
+}
+
+int main(int argc, const char * const argv[])
+{
+    int rv;
+    int i;
+    dw_ctxt_t *ctxt = NULL;
+    apr_pool_t *p = NULL;
+    apr_initialize();
+    atexit(apr_terminate);
+    
+    apr_pool_create(&p, NULL);
+    
+    dw_create_context(p, &ctxt);
+    
+    for (i = 1; i < argc; i++) {
+        if (strcmp("--version", argv[i]) == 0) {
+            dw_show_version(ctxt);
+        }
+        else if (strcmp("--modules", argv[i]) == 0 && i+1 < argc) {
+            ctxt->m_conf.modules_path = argv[++i];
+        }
+        else if (strcmp("--addr", argv[i]) == 0 && i+1 < argc) {
+            ctxt->m_conf.addr = argv[++i];
+        }
+        else if (strcmp("--port", argv[i]) == 0 && i+1 < argc) {
+            ctxt->m_conf.port = atoi(argv[++i]);
+        }
+        else if (strcmp("--threads", argv[i]) == 0 && i+1 < argc) {
+            ctxt->m_conf.threads = atoi(argv[++i]);
+        }
+        else if (strcmp("--verbose", argv[i]) == 0) {
+            ctxt->m_conf.verbose = 1;
+        }
+        else if (strcmp("--help", argv[i]) == 0 && i+1 < argc) {
+            dw_show_usage(ctxt);
+        }
+        else {
+            apr_file_printf(ctxt->errfile, "Error: unknown parameter.\n");
+            dw_show_usage(ctxt);
+        }
+    }
+    
+    if (ctxt->m_conf.verbose) {
+        apr_file_printf(ctxt->outfile, "dworker configuration:\n");
+        apr_file_printf(ctxt->outfile, "\tAddress: %s\n", ctxt->m_conf.addr);
+        apr_file_printf(ctxt->outfile, "\tPort: %d\n", ctxt->m_conf.port);
+        apr_file_printf(ctxt->outfile, "\tModules Path: %s\n", ctxt->m_conf.modules_path);
+        apr_file_printf(ctxt->outfile, "\tNum Threads: %d\n", ctxt->m_conf.threads);
+    }
+    
+    if (!ctxt->m_conf.modules_path) {
+        apr_file_printf(ctxt->errfile, "Error: --modules is a required parameter.\n");
+        return EXIT_FAILURE;
+    }
+    
+    rv = dw_run(ctxt);
+    
+    return rv;
+}
+

Propchange: labs/dworker/trunk/server/dworker.c
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org