<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,13 @@
+2009-03-14  Mikio Hirabayashi  &lt;mikio@users.sourceforge.net&gt;
+
+	* ttservctl: configuration was modified and update log is now disabled by default.
+
+	* ttutil.c (ttopensock, ttacceptsock): performance was improved.
+
+	* scrext.c (scrextnew): a parameter for the logger was added.
+
+	- Release: 1.1.18
+
 2009-02-19  Mikio Hirabayashi  &lt;mikio@users.sourceforge.net&gt;
 
 	* ttutil.c (tthttpfetch): timeout mechanism was added.</diff>
      <filename>ChangeLog</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for tokyotyrant 1.1.17.
+# Generated by GNU Autoconf 2.61 for tokyotyrant 1.1.18.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -572,8 +572,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='tokyotyrant'
 PACKAGE_TARNAME='tokyotyrant'
-PACKAGE_VERSION='1.1.17'
-PACKAGE_STRING='tokyotyrant 1.1.17'
+PACKAGE_VERSION='1.1.18'
+PACKAGE_STRING='tokyotyrant 1.1.18'
 PACKAGE_BUGREPORT=''
 
 # Factoring default headers for most tests.
@@ -1194,7 +1194,7 @@ if test &quot;$ac_init_help&quot; = &quot;long&quot;; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat &lt;&lt;_ACEOF
-\`configure' configures tokyotyrant 1.1.17 to adapt to many kinds of systems.
+\`configure' configures tokyotyrant 1.1.18 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1255,7 +1255,7 @@ fi
 
 if test -n &quot;$ac_init_help&quot;; then
   case $ac_init_help in
-     short | recursive ) echo &quot;Configuration of tokyotyrant 1.1.17:&quot;;;
+     short | recursive ) echo &quot;Configuration of tokyotyrant 1.1.18:&quot;;;
    esac
   cat &lt;&lt;\_ACEOF
 
@@ -1349,7 +1349,7 @@ fi
 test -n &quot;$ac_init_help&quot; &amp;&amp; exit $ac_status
 if $ac_init_version; then
   cat &lt;&lt;\_ACEOF
-tokyotyrant configure 1.1.17
+tokyotyrant configure 1.1.18
 generated by GNU Autoconf 2.61
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1363,7 +1363,7 @@ cat &gt;config.log &lt;&lt;_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by tokyotyrant $as_me 1.1.17, which was
+It was created by tokyotyrant $as_me 1.1.18, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
@@ -1719,7 +1719,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 # Package information
 MYLIBVER=3
-MYLIBREV=1
+MYLIBREV=2
 MYPROTVER=&quot;0.9&quot;
 
 # Targets
@@ -5912,7 +5912,7 @@ exec 6&gt;&amp;1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log=&quot;
-This file was extended by tokyotyrant $as_me 1.1.17, which was
+This file was extended by tokyotyrant $as_me 1.1.18, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5955,7 +5955,7 @@ Report bugs to &lt;bug-autoconf@gnu.org&gt;.&quot;
 _ACEOF
 cat &gt;&gt;$CONFIG_STATUS &lt;&lt;_ACEOF
 ac_cs_version=&quot;\\
-tokyotyrant config.status 1.1.17
+tokyotyrant config.status 1.1.18
 configured by $0, generated by GNU Autoconf 2.61,
   with options \\&quot;`echo &quot;$ac_configure_args&quot; | sed 's/^ //; s/[\\&quot;&quot;\`\$]/\\\\&amp;/g'`\\&quot;
 </diff>
      <filename>configure</filename>
    </modified>
    <modified>
      <diff>@@ -7,11 +7,11 @@
 #================================================================
 
 # Package name
-AC_INIT(tokyotyrant, 1.1.17)
+AC_INIT(tokyotyrant, 1.1.18)
 
 # Package information
 MYLIBVER=3
-MYLIBREV=1
+MYLIBREV=2
 MYPROTVER=&quot;0.9&quot;
 
 # Targets</diff>
      <filename>configure.in</filename>
    </modified>
    <modified>
      <diff>@@ -828,7 +828,7 @@ var {
 &lt;dd&gt;Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string.  Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.&lt;/dd&gt;
 &lt;/dl&gt;
 
-&lt;p&gt;The function `tcrdbext2' is used in order to call a function of the script language extension.&lt;/p&gt;
+&lt;p&gt;The function `tcrdbext2' is used in order to call a function of the script language extension with string parameters.&lt;/p&gt;
 
 &lt;dl class=&quot;api&quot;&gt;
 &lt;dt&gt;&lt;code&gt;char *tcrdbext2(TCRDB *&lt;var&gt;rdb&lt;/var&gt;, const char *&lt;var&gt;name&lt;/var&gt;, int &lt;var&gt;opts&lt;/var&gt;, const char *&lt;var&gt;kstr&lt;/var&gt;, const char *&lt;var&gt;vstr&lt;/var&gt;);&lt;/code&gt;&lt;/dt&gt;</diff>
      <filename>doc/index.html</filename>
    </modified>
    <modified>
      <diff>@@ -390,6 +390,17 @@ function mkdir(key, value)
 end
 
 
+-- log a string
+function log(key, value)
+   local level = tonumber(value)
+   if not level then
+      level = 1
+   end
+   _log(key, level)
+   return &quot;ok&quot;
+end
+
+
 -- print a string
 function hello()
    print(&quot;hello: &quot; .. _time())</diff>
      <filename>ext/senatus.lua</filename>
    </modified>
    <modified>
      <diff>@@ -679,7 +679,7 @@ Because an additional zero code is appended at the end of the region of the retu
 .RE
 .RE
 .PP
-The function `tcrdbext2' is used in order to call a function of the script language extension.
+The function `tcrdbext2' is used in order to call a function of the script language extension with string parameters.
 .PP
 .RS
 .br</diff>
      <filename>man/tcrdb.3</filename>
    </modified>
    <modified>
      <diff>@@ -200,6 +200,7 @@
 #include &lt;dirent.h&gt;
 #include &lt;aio.h&gt;
 #include &lt;netinet/in.h&gt;
+#include &lt;netinet/tcp.h&gt;
 #include &lt;arpa/inet.h&gt;
 #include &lt;netdb.h&gt;
 </diff>
      <filename>myconf.h</filename>
    </modified>
    <modified>
      <diff>@@ -26,7 +26,7 @@
 #if defined(TTNOEXT)
 
 
-typedef struct {                         // type of structure of logging opaque object
+typedef struct {                         // type of structure of the script extension
   int thnum;                             // number of native threads
   int thid;                              // thread ID
   char *path;                            // path of the initializing script
@@ -37,13 +37,14 @@ typedef struct {                         // type of structure of logging opaque
   pthread_mutex_t *lcks;                 // mutex for user locks
   int lcknum;                            // number of user locks
   void (*logger)(int, const char *, void *);  // logging function
+  void *logopq;                          // opaque pointer for the logging function
 } SCREXT;
 
 
 /* Initialize the global scripting language extension. */
 void *scrextnew(int thnum, int thid, const char *path, TCADB *adb, TCULOG *ulog,
                 uint32_t sid, TCMDB *stash, pthread_mutex_t *lcks, int lcknum,
-                void (*logger)(int, const char *, void *)){
+                void (*logger)(int, const char *, void *), void *logopq){
   SCREXT *scr = tcmalloc(sizeof(*scr));
   scr-&gt;thnum = thnum;
   scr-&gt;thid = thid;
@@ -55,6 +56,7 @@ void *scrextnew(int thnum, int thid, const char *path, TCADB *adb, TCULOG *ulog,
   scr-&gt;lcks = lcks;
   scr-&gt;lcknum = lcknum;
   scr-&gt;logger = logger;
+  scr-&gt;logopq = logopq;
   return scr;
 }
 
@@ -99,7 +101,7 @@ char *scrextcallmethod(void *scr, const char *name,
     return tcadbget(myscr-&gt;adb, kbuf, ksiz, sp);
   } else if(!strcmp(name, &quot;log&quot;)){
     char *msg = tcmemdup(kbuf, ksiz);
-    myscr-&gt;logger(TTLOGINFO, msg, NULL);
+    myscr-&gt;logger(TTLOGINFO, msg, myscr-&gt;logopq);
     tcfree(msg);
     msg = tcstrdup(&quot;ok&quot;);
     *sp = strlen(msg);
@@ -144,7 +146,7 @@ char *scrextcallmethod(void *scr, const char *name,
 #define SERVVAR      &quot;_serv_&quot;            // global variable name for server resources
 #define ITERVAR      &quot;_iter_&quot;            // global variable name for iterator
 
-typedef struct {                         // type of structure of logging opaque object
+typedef struct {                         // type of structure of the script extension
   int thnum;                             // number of native threads
   int thid;                              // thread ID
   lua_State *lua;                        // Lua environment
@@ -158,6 +160,7 @@ typedef struct {                         // type of structure of the server data
   pthread_mutex_t *lcks;                 // mutex for user locks
   int lcknum;                            // number of user locks
   void (*logger)(int, const char *, void *);  // logging function
+  void *logopq;                          // opaque pointer for the logging function
 } SERV;
 
 
@@ -207,7 +210,7 @@ static int serv_mkdir(lua_State *lua);
 /* Initialize the global scripting language extension. */
 void *scrextnew(int thnum, int thid, const char *path, TCADB *adb, TCULOG *ulog,
                 uint32_t sid, TCMDB *stash, pthread_mutex_t *lcks, int lcknum,
-                void (*logger)(int, const char *, void *)){
+                void (*logger)(int, const char *, void *), void *logopq){
   int isiz;
   char *ibuf = tcreadfile(path, 0, &amp;isiz);
   if(!ibuf) return NULL;
@@ -226,6 +229,7 @@ void *scrextnew(int thnum, int thid, const char *path, TCADB *adb, TCULOG *ulog,
   serv-&gt;lcks = lcks;
   serv-&gt;lcknum = lcknum;
   serv-&gt;logger = logger;
+  serv-&gt;logopq = logopq;
   lua_setglobal(lua, SERVVAR);
   lua_register(lua, &quot;_log&quot;, serv_log);
   lua_register(lua, &quot;_put&quot;, serv_put);
@@ -342,7 +346,7 @@ static void reporterror(lua_State *lua){
   char *msg = tcsprintf(&quot;Lua error: %s&quot;, argc &gt; 0 ? lua_tostring(lua, argc) : &quot;unknown&quot;);
   lua_getglobal(lua, SERVVAR);
   SERV *serv = lua_touserdata(lua, -1);
-  serv-&gt;logger(TTLOGERROR, msg, NULL);
+  serv-&gt;logger(TTLOGERROR, msg, serv-&gt;logopq);
   tcfree(msg);
 }
 
@@ -385,7 +389,7 @@ static int serv_log(lua_State *lua){
   if(argc &gt; 1) level = lua_tointeger(lua, 2);
   lua_getglobal(lua, SERVVAR);
   SERV *serv = lua_touserdata(lua, -1);
-  serv-&gt;logger(level, msg, NULL);
+  serv-&gt;logger(level, msg, serv-&gt;logopq);
   return 0;
 }
 </diff>
      <filename>scrext.c</filename>
    </modified>
    <modified>
      <diff>@@ -54,10 +54,11 @@
    `lcks' specifies the mutex objects for user locks.
    `lcknum' specifies the number of user locks.
    `logger' specifies the pointer to a function to do with a log message.
+   `logopq' specifies the opaque pointer for the logging function.
    The return value is the scripting object or `NULL' on failure. */
 void *scrextnew(int thnum, int thid, const char *path, TCADB *adb, TCULOG *ulog,
                 uint32_t sid, TCMDB *stash, pthread_mutex_t *lcks, int lcknum,
-                void (*logger)(int, const char *, void *));
+                void (*logger)(int, const char *, void *), void *logopq);
 
 
 /* Destroy the scripting language extension.</diff>
      <filename>scrext.h</filename>
    </modified>
    <modified>
      <diff>@@ -856,7 +856,7 @@ void *tcrdbext(TCRDB *rdb, const char *name, int opts,
 }
 
 
-/* Call a function of the scripting language extension. */
+/* Call a function of the scripting language extension with string parameters. */
 char *tcrdbext2(TCRDB *rdb, const char *name, int opts, const char *kstr, const char *vstr){
   assert(rdb &amp;&amp; name &amp;&amp; kstr &amp;&amp; vstr);
   int vsiz;</diff>
      <filename>tcrdb.c</filename>
    </modified>
    <modified>
      <diff>@@ -379,7 +379,7 @@ void *tcrdbext(TCRDB *rdb, const char *name, int opts,
                const void *kbuf, int ksiz, const void *vbuf, int vsiz, int *sp);
 
 
-/* Call a function of the scripting language extension.
+/* Call a function of the scripting language extension with string parameters.
    `rdb' specifies the remote database object.
    `name' specifies the function name.
    `opts' specifies options by bitwise-or: `RDBXOLCKREC' for record locking, `RDBXOLCKGLB' for</diff>
      <filename>tcrdb.h</filename>
    </modified>
    <modified>
      <diff>@@ -11,19 +11,23 @@ cmd=&quot;ttserver&quot;
 basedir=&quot;/var/ttserver&quot;
 port=&quot;1978&quot;
 pidfile=&quot;$basedir/pid&quot;
-logfile=&quot;$basedir/log&quot;
-ulogdir=&quot;$basedir/ulog&quot;
-ulimsiz=&quot;256m&quot;
-sid=1
+#logfile=&quot;$basedir/log&quot;
+#ulogdir=&quot;$basedir/ulog&quot;
+#ulimsiz=&quot;256m&quot;
+#sid=1
+#mhost=&quot;remotehost1&quot;
+#mport=&quot;1978&quot;
+#rtsfile=&quot;$basedir/rts&quot;
 dbname=&quot;$basedir/casket.tch#bnum=1000000&quot;
 maxcon=&quot;65536&quot;
 retval=0
 
 
-# locale clear
+# setting environment variables
 LANG=C
 LC_ALL=C
-export LANG LC_ALL
+PATH=&quot;$PATH:/sbin:/usr/sbin:/usr/local/sbin&quot;
+export LANG LC_ALL PATH
 
 
 # start the server
@@ -31,20 +35,43 @@ start(){
   printf 'Starting the server of Tokyo Tyrant\n'
   ulimit -n &quot;$maxcon&quot;
   mkdir -p &quot;$basedir&quot;
-  if [ -f &quot;$pidfile&quot; ] ; then
+  if [ -z &quot;$basedir&quot; ] || [ -z &quot;$port&quot; ] || [ -z &quot;$pidfile&quot; ] || [ -z &quot;$dbname&quot; ] ; then
+    printf 'Invalid configuration\n'
+    retval=1
+  elif ! [ -d &quot;$basedir&quot; ] ; then
+    printf 'No such directory: %s\n' &quot;$basedir&quot;
+    retval=1
+  elif [ -f &quot;$pidfile&quot; ] ; then
     pid=`cat &quot;$pidfile&quot;`
     printf 'Existing process: %d\n' &quot;$pid&quot;
     retval=1
   else
-    $cmd \
-      -port &quot;$port&quot; \
-      -dmn \
-      -pid &quot;$pidfile&quot; \
-      -log &quot;$logfile&quot; \
-      -ulog &quot;$ulogdir&quot; \
-      -ulim &quot;$ulimsiz&quot; \
-      -sid &quot;$sid&quot; \
-      &quot;$dbname&quot;
+    cmd=&quot;$cmd -port $port -dmn -pid $pidfile&quot;
+    if [ -n &quot;$logfile&quot; ] ; then
+      cmd=&quot;$cmd -log $logfile&quot;
+    fi
+    if [ -n &quot;$ulogdir&quot; ] ; then
+      mkdir -p &quot;$ulogdir&quot;
+      cmd=&quot;$cmd -ulog $ulogdir&quot;
+    fi
+    if [ -n &quot;$ulimsiz&quot; ] ; then
+      cmd=&quot;$cmd -ulim $ulimsiz&quot;
+    fi
+    if [ -n &quot;$sid&quot; ] ; then
+      cmd=&quot;$cmd -sid $sid&quot;
+    fi
+    if [ -n &quot;$mhost&quot; ] ; then
+      cmd=&quot;$cmd -mhost $mhost&quot;
+    fi
+    if [ -n &quot;$mport&quot; ] ; then
+      cmd=&quot;$cmd -mport $mport&quot;
+    fi
+    if [ -n &quot;$rtsfile&quot; ] ; then
+      cmd=&quot;$cmd -rts $rtsfile&quot;
+    fi
+    printf &quot;Executing: %s\n&quot; &quot;$cmd&quot;
+    cmd=&quot;$cmd $dbname&quot;
+    $cmd
     if [ &quot;$?&quot; -eq 0 ] ; then
       printf 'Done\n'
     else
@@ -60,6 +87,7 @@ stop(){
   printf 'Stopping the server of Tokyo Tyrant\n'
   if [ -f &quot;$pidfile&quot; ] ; then
     pid=`cat &quot;$pidfile&quot;`
+    printf &quot;Sending the terminal signal to the process: %s\n&quot; &quot;$pid&quot;
     kill -TERM &quot;$pid&quot;
     c=0
     while true ; do
@@ -67,7 +95,7 @@ stop(){
       if [ -f &quot;$pidfile&quot; ] ; then
         c=`expr $c + 1`
         if [ &quot;$c&quot; -ge 100 ] ; then
-          printf 'Hunging process: %d\n' &quot;$pid&quot;
+          printf 'Hanging process: %d\n' &quot;$pid&quot;
           retval=1
           break
         fi
@@ -88,6 +116,7 @@ hup(){
   printf 'Sending HUP signal to the server of Tokyo Tyrant\n'
   if [ -f &quot;$pidfile&quot; ] ; then
     pid=`cat &quot;$pidfile&quot;`
+    printf &quot;Sending the hangup signal to the process: %s\n&quot; &quot;$pid&quot;
     kill -HUP &quot;$pid&quot;
     printf 'Done\n'
   else</diff>
      <filename>ttservctl</filename>
    </modified>
    <modified>
      <diff>@@ -538,7 +538,7 @@ static int proc(const char *dbname, const char *host, int port, int thnum, int t
     bool screrr = false;
     for(int i = 0; i &lt; thnum; i++){
       screxts[i] = scrextnew(thnum, i, extpath, adb, ulog, sid, scrstash,
-                             scrlcks, RECMTXNUM, do_log);
+                             scrlcks, RECMTXNUM, do_log, &amp;larg);
       if(!screxts[i]) screrr = true;
     }
     if(screrr){
@@ -578,7 +578,7 @@ static int proc(const char *dbname, const char *host, int port, int thnum, int t
       pcarg-&gt;sid = sid;
       pcarg-&gt;sarg = &amp;sarg;
       pcarg-&gt;scrext = scrextnew(thnum, thnum + i, extpath, adb, ulog, sid, scrstash,
-                                scrlcks, RECMTXNUM, do_log);
+                                scrlcks, RECMTXNUM, do_log, &amp;larg);
       if(pcarg-&gt;scrext){
         if(*name &amp;&amp; period &gt; 0) ttservaddtimedhandler(g_serv, period, do_extpc, pcarg);
       } else {</diff>
      <filename>ttserver.c</filename>
    </modified>
    <modified>
      <diff>@@ -105,6 +105,8 @@ int ttopensock(const char *addr, int port){
   opttv.tv_sec = (int)SOCKSNDTIMEO;
   opttv.tv_usec = (SOCKSNDTIMEO - (int)SOCKSNDTIMEO) * 1000000;
   setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char *)&amp;opttv, sizeof(opttv));
+  int optint = 1;
+  setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&amp;optint, sizeof(optint));
   return fd;
 }
 
@@ -196,6 +198,8 @@ int ttacceptsock(int fd, char *addr, int *pp){
       opttv.tv_sec = (int)SOCKSNDTIMEO;
       opttv.tv_usec = (SOCKSNDTIMEO - (int)SOCKSNDTIMEO) * 1000000;
       setsockopt(cfd, SOL_SOCKET, SO_SNDTIMEO, (char *)&amp;opttv, sizeof(opttv));
+      int optint = 1;
+      setsockopt(cfd, IPPROTO_TCP, TCP_NODELAY, (char *)&amp;optint, sizeof(optint));
       if(addr){
         if(getnameinfo((struct sockaddr *)&amp;sain, sizeof(sain), addr, TTADDRBUFSIZ,
                        NULL, 0, NI_NUMERICHOST) != 0) sprintf(addr, &quot;0.0.0.0&quot;);</diff>
      <filename>ttutil.c</filename>
    </modified>
    <modified>
      <diff>@@ -419,8 +419,8 @@ bool ttserviskilled(TTSERV *serv);
  *************************************************************************************************/
 
 
-#define _TT_VERSION    &quot;1.1.17&quot;
-#define _TT_LIBVER     301
+#define _TT_VERSION    &quot;1.1.18&quot;
+#define _TT_LIBVER     302
 #define _TT_PROTVER    &quot;0.9&quot;
 
 </diff>
      <filename>ttutil.h</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>264d1c6ce065031ca27a0b1176b0507dd1a185e3</id>
    </parent>
  </parents>
  <author>
    <name>Bob Ippolito</name>
    <email>bob@redivi.com</email>
  </author>
  <url>http://github.com/etrepum/tokyo-tyrant/commit/32d8bca0f18a89e4c329c8dcaa5ac867f902e9b1</url>
  <id>32d8bca0f18a89e4c329c8dcaa5ac867f902e9b1</id>
  <committed-date>2009-03-23T15:03:16-07:00</committed-date>
  <authored-date>2009-03-23T15:03:16-07:00</authored-date>
  <message>sync with tokyotyrant-1.1.18.tar.gz</message>
  <tree>476750e899d0c6693c1905ce199a78f9bc9d68f8</tree>
  <committer>
    <name>Bob Ippolito</name>
    <email>bob@redivi.com</email>
  </committer>
</commit>
