Permalink
Browse files

use detach to remove socket from EM

  • Loading branch information...
1 parent 2725f29 commit 14c1affc2fb7ba07d473c0da9b100fce557acd06 @tmm1 committed Sep 7, 2008
Showing with 15 additions and 3 deletions.
  1. +3 −1 lib/em/mysql.rb
  2. +12 −2 test.rb
View
@@ -131,7 +131,9 @@ def close
# @mysql.close
# IO.pipe
# EM.add_timer(0){ close_connection }
- close_connection
+ # close_connection
+ fd = detach
+ log 'detached fd', fd
end
private
View
14 test.rb
@@ -1,13 +1,23 @@
require 'lib/em/mysql'
+# EM.kqueue
+# EM.epoll
EM.run{
+ EM.start_server '127.0.0.1', 12345 do |c|
+ def c.receive_data data
+ p 'sending http response'
+ send_data "hello"
+ close_connection_after_writing
+ end
+ end
+
SQL = EventedMysql
def SQL(query, &blk) SQL.select(query, &blk) end
SQL.settings.update :logging => true,
:database => 'test',
- :connections => 25,
- :timeout => 3
+ :connections => 10,
+ :timeout => 1
if false

0 comments on commit 14c1aff

Please sign in to comment.