knjappserver 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.18
1
+ 0.0.19
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{knjappserver}
8
- s.version = "0.0.18"
8
+ s.version = "0.0.19"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kasper Johansen"]
12
- s.date = %q{2012-02-25}
12
+ s.date = %q{2012-03-04}
13
13
  s.description = %q{Which supports a lot of undocumented stuff.}
14
14
  s.email = %q{k@spernj.org}
15
15
  s.executables = ["check_running.rb", "knjappserver_start.rb"]
@@ -69,13 +69,23 @@ class Knjappserver::Httpsession
69
69
  @size_send = @config[:size_send]
70
70
  @alert_sent = false
71
71
  @working = false
72
+ break if @kas.should_restart
73
+
74
+ STDOUT.print "#{__id__} - Waiting to parse from socket.\n" if @debug
72
75
 
73
- Timeout.timeout(1500) do
76
+ #Timeout on sockets is currently broken in JRuby.
77
+ if RUBY_ENGINE == "jruby"
74
78
  @handler.socket_parse(@socket)
79
+ else
80
+ Timeout.timeout(1800) do
81
+ @handler.socket_parse(@socket)
82
+ end
75
83
  end
76
84
 
85
+ STDOUT.print "#{__id__} - Done parsing from socket.\n" if @debug
86
+
77
87
  while @kas.paused? #Check if we should be waiting with executing the pending request.
78
- STDOUT.print "Paused! (#{@kas.paused}) - sleeping.\n" if @debug
88
+ STDOUT.print "#{__id__} - Paused! (#{@kas.paused}) - sleeping.\n" if @debug
79
89
  sleep 0.1
80
90
  end
81
91
 
@@ -83,7 +93,7 @@ class Knjappserver::Httpsession
83
93
 
84
94
  if @config.key?(:max_requests_working)
85
95
  while @httpserver and @config and @httpserver.working_count.to_i >= @config[:max_requests_working].to_i
86
- STDOUT.print "Maximum amounts of requests are working (#{@httpserver.working_count}, #{@config[:max_requests_working]}) - sleeping.\n" if @debug
96
+ STDOUT.print "#{__id__} - Maximum amounts of requests are working (#{@httpserver.working_count}, #{@config[:max_requests_working]}) - sleeping.\n" if @debug
87
97
  sleep 0.1
88
98
  end
89
99
  end
@@ -94,22 +104,26 @@ class Knjappserver::Httpsession
94
104
 
95
105
  @httpserver.count_add
96
106
  @working = true
97
- STDOUT.print "Serving.\n" if @debug
98
- self.serve
99
- ensure
100
- @httpserver.count_remove
101
- @kas.served += 1 if @kas
102
- @working = false
107
+ STDOUT.print "#{__id__} - Serving.\n" if @debug
103
108
 
109
+ begin
110
+ self.serve
111
+ ensure
112
+ @httpserver.count_remove
113
+ @kas.served += 1 if @kas
114
+ @working = false
115
+ end
116
+ ensure
117
+ STDOUT.print "#{__id__} - Closing request.\n" if @debug
104
118
  #Free reserved database-connections.
105
119
  @kas.db_handler.free_thread if @kas and @kas.db_handler.opts[:threadsafe]
106
120
  @kas.ob.db.free_thread if @kas and @kas.ob.db.opts[:threadsafe]
107
121
  end
108
122
  end
109
- rescue Errno::ECONNRESET, Errno::ENOTCONN, Errno::EPIPE, Timeout::Error => e
110
- #Ignore - the user probaly left.
111
- #STDOUT.puts e.inspect
112
- #STDOUT.puts e.backtrace
123
+ rescue Timeout::Error
124
+ STDOUT.print "#{__id__} - Closing httpsession because of timeout.\n" if @debug
125
+ rescue Errno::ECONNRESET, Errno::ENOTCONN, Errno::EPIPE => e
126
+ STDOUT.print "#{__id__} - Connection error (#{e.inspect})...\n" if @debug
113
127
  rescue SystemExit, Interrupt => e
114
128
  raise e
115
129
  rescue Exception => e
@@ -47,10 +47,14 @@ class Knjappserver::Httpsession::Http_response
47
47
 
48
48
  @headers_11 = {
49
49
  "Connection" => "Keep-Alive",
50
- "Transfer-Encoding" => "chunked",
51
- "Keep-Alive" => "timeout=15, max=30"
50
+ "Transfer-Encoding" => "chunked"
52
51
  }
53
52
 
53
+ #Socket-timeout is currently broken in JRuby.
54
+ if RUBY_ENGINE != "jruby"
55
+ @headers_11["Keep-Alive"] = "timeout=15, max=30"
56
+ end
57
+
54
58
  @cookies = []
55
59
  end
56
60
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knjappserver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-25 00:00:00.000000000 +01:00
12
+ date: 2012-03-04 00:00:00.000000000 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: knjrbfw
17
- requirement: &27853120 !ruby/object:Gem::Requirement
17
+ requirement: &28196100 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *27853120
25
+ version_requirements: *28196100
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: erubis
28
- requirement: &27852420 !ruby/object:Gem::Requirement
28
+ requirement: &28195520 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *27852420
36
+ version_requirements: *28195520
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: mail
39
- requirement: &27837000 !ruby/object:Gem::Requirement
39
+ requirement: &28194940 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *27837000
47
+ version_requirements: *28194940
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rspec
50
- requirement: &27836360 !ruby/object:Gem::Requirement
50
+ requirement: &28194360 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 2.3.0
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *27836360
58
+ version_requirements: *28194360
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: bundler
61
- requirement: &27835720 !ruby/object:Gem::Requirement
61
+ requirement: &28193840 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.0.0
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *27835720
69
+ version_requirements: *28193840
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: jeweler
72
- requirement: &27835120 !ruby/object:Gem::Requirement
72
+ requirement: &28193300 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 1.6.3
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *27835120
80
+ version_requirements: *28193300
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rcov
83
- requirement: &27834480 !ruby/object:Gem::Requirement
83
+ requirement: &28192780 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *27834480
91
+ version_requirements: *28192780
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: sqlite3
94
- requirement: &27833880 !ruby/object:Gem::Requirement
94
+ requirement: &28192240 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *27833880
102
+ version_requirements: *28192240
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: json
105
- requirement: &27833320 !ruby/object:Gem::Requirement
105
+ requirement: &28190420 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,7 +110,7 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *27833320
113
+ version_requirements: *28190420
114
114
  description: Which supports a lot of undocumented stuff.
115
115
  email: k@spernj.org
116
116
  executables:
@@ -206,7 +206,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
206
  version: '0'
207
207
  segments:
208
208
  - 0
209
- hash: -3895621098014444760
209
+ hash: -2708344382107765429
210
210
  required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  none: false
212
212
  requirements: