<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/c_threaded_test.rb</filename>
    </added>
    <added>
      <filename>test/native_threaded_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -269,11 +269,14 @@ static VALUE real_connect(int argc, VALUE* argv, VALUE klass)
 
     myp-&gt;handler.reconnect = 0;
     myp-&gt;connection = Qtrue;
-    
+
     my_bool was_blocking;
+
     vio_blocking(myp-&gt;handler.net.vio, 0, &amp;was_blocking);    
     myp-&gt;blocking = vio_is_blocking( myp-&gt;handler.net.vio );
 
+    vio_fastsend( myp-&gt;handler.net.vio );
+
     myp-&gt;query_with_result = Qtrue;
     rb_obj_call_init(obj, argc, argv);
 
@@ -786,6 +789,13 @@ static VALUE socket(VALUE obj)
     MYSQL* m = GetHandler(obj);
     return INT2NUM(m-&gt;net.fd);
 }
+/* socket_type */
+static VALUE socket_type(VALUE obj)
+{
+    MYSQL* m = GetHandler(obj);
+    VALUE description = vio_description( m-&gt;net.vio );
+    return NILorSTRING( description );
+}
 
 /* blocking */
 static VALUE blocking(VALUE obj){
@@ -838,43 +848,35 @@ static VALUE get_result(VALUE obj)
     return store_result(obj);
 }
 
+static VALUE schedule(VALUE obj, VALUE timeout)
+{
+    MYSQL* m = GetHandler(obj);
+    fd_set read;
+
+    timeout = ( NIL_P(timeout) ? m-&gt;net.read_timeout : INT2NUM(timeout) );
+
+    struct timeval tv = { tv_sec: timeout, tv_usec: 0 };
+
+    FD_ZERO(&amp;read);
+    FD_SET(m-&gt;net.fd, &amp;read);
+
+    if (rb_thread_select(m-&gt;net.fd + 1, &amp;read, NULL, NULL, &amp;tv) &lt; 0) {
+      rb_raise(eMysql, &quot;query: timeout&quot;);
+    }
+
+}
+
 /* async_query(sql,timeout=nil) */
 static VALUE async_query(int argc, VALUE* argv, VALUE obj)
 {
   MYSQL* m = GetHandler(obj); 
   VALUE sql, timeout;
-  fd_set read;
-  int ret;
 
   rb_scan_args(argc, argv, &quot;11&quot;, &amp;sql, &amp;timeout);
 
   send_query(obj,sql);
 
-  if (NIL_P(timeout)) {
-    timeout = m-&gt;net.read_timeout;
-  }
-
-  VALUE args[1];
-  args[0] = timeout;
-
-  struct timeval tv = { tv_sec: timeout, tv_usec: 0 };
-
-  for(;;) {
-    FD_ZERO(&amp;read);
-    FD_SET(m-&gt;net.fd, &amp;read);
-      ret = rb_thread_select(m-&gt;net.fd + 1, &amp;read, NULL, NULL, &amp;tv);
-      if (ret &lt; 0) {
-        rb_sys_fail(0);
-      }
-              
-      if (ret == 0) {
-        continue;
-      }
-
-      if (readable(1, (VALUE *)args, obj) == Qtrue) {
-        break;
-      }
-  }
+  schedule(obj, timeout);
 
   return get_result(obj);
 }
@@ -2172,6 +2174,7 @@ void Init_mysql(void)
     rb_define_method(cMysql, &quot;readable?&quot;, readable, -1);
     rb_define_method(cMysql, &quot;blocking?&quot;, blocking, 0);
     rb_define_method(cMysql, &quot;socket&quot;, socket, 0);
+    rb_define_method(cMysql, &quot;socket_type&quot;, socket_type, 0);
     rb_define_method(cMysql, &quot;refresh&quot;, refresh, 1);
     rb_define_method(cMysql, &quot;reload&quot;, reload, 0);
     rb_define_method(cMysql, &quot;select_db&quot;, select_db, 1);</diff>
      <filename>ext/mysql.c</filename>
    </modified>
    <modified>
      <diff>@@ -15,7 +15,8 @@ Gem::Specification.new do |s|
 		&quot;Rakefile&quot;,
 		&quot;lib/mysqlplus.rb&quot;,
 		&quot;test/test_helper.rb&quot;,
-		&quot;test/threaded_test.rb&quot;,
+		&quot;test/native_threaded_test.rb&quot;,
+		&quot;test/c_threaded_test.rb&quot;,
 		&quot;test/evented_test.rb&quot;,
 		&quot;ext/error_const.h&quot;,
 		&quot;ext/extconf.rb&quot;,</diff>
      <filename>mysqlplus.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,11 @@
 require File.dirname(__FILE__) + '/test_helper'
 
+EventedMysqlTest.new( 10, &quot;Evented, very small overhead&quot; ) do |test|
+  test.setup{ Mysql.real_connect('localhost','root') }
+  test.per_query_overhead = 0.005
+  test.run!
+end
+
 EventedMysqlTest.new( 10, &quot;Evented, small overhead&quot; ) do |test|
   test.setup{ Mysql.real_connect('localhost','root') }
   test.per_query_overhead = 0.1</diff>
      <filename>test/evented_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,15 +12,17 @@ class MysqlTest
                 :connection_signature,
                 :start,
                 :done,
-                :c_async_query,
-                :per_query_overhead
+                :query_with,
+                :per_query_overhead,
+                :timeout
   
   def initialize( queries, context = '' )
     @queries = queries
     @context = context
     @done = []
-    @c_async_query = false
+    @query_with = :async_query
     @per_query_overhead = 3
+    @timeout = 20
     yield self if block_given?
   end
   
@@ -76,7 +78,7 @@ class MysqlTest
   end
   
   def c_or_native_ruby_async_query
-    if @c_async_query
+    if @query_with == :c_async_query
       log &quot;** using C based async_query&quot;
     else
       log &quot;** using native Ruby async_query&quot;
@@ -84,9 +86,8 @@ class MysqlTest
     yield
   end
   
-  def c_or_native_async_query( connection, sql, timeout = nil )
-    method = @c_async_query ? :c_async_query : :async_query
-    connection.send( method, sql, timeout )
+  def dispatch_query( connection, sql, timeout = nil )
+    connection.send( @query_with, sql, timeout )
   end
   
 end
@@ -186,7 +187,7 @@ class ThreadedMysqlTest &lt; MysqlTest
 
           log &quot;sending query on connection #{conn}&quot;
 
-          c_or_native_async_query( @connections[conn], &quot;select sleep(#{@per_query_overhead})&quot; ).each do |result|
+          dispatch_query( @connections[conn], &quot;select sleep(#{@per_query_overhead})&quot;, @timeout ).each do |result|
             log &quot;connection #{conn} done&quot;
           end 
         </diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>test/threaded_test.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>02e265072ca7fa65b2e763bd501bfbfc389d730a</id>
    </parent>
    <parent>
      <id>c17d4b6a7a6aa6591a37f4cc43c9951c9f3ecb1f</id>
    </parent>
  </parents>
  <author>
    <name>Roger Pack</name>
    <email>rogerpack@roger-packs-macbook-pro.local</email>
  </author>
  <url>http://github.com/oldmoe/mysqlplus/commit/f73ba931ef8301313b037cd19612cb72edfa012a</url>
  <id>f73ba931ef8301313b037cd19612cb72edfa012a</id>
  <committed-date>2008-09-24T10:01:14-07:00</committed-date>
  <authored-date>2008-09-24T10:01:14-07:00</authored-date>
  <message>overcome conflict</message>
  <tree>b6601933c78664bea253c84c5f7f1939bd89c19f</tree>
  <committer>
    <name>Roger Pack</name>
    <email>rogerpack@roger-packs-macbook-pro.local</email>
  </committer>
</commit>
