siriproxy 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,13 +24,28 @@ class SiriProxy
24
24
 
25
25
  begin
26
26
  listen_addr = $APP_CONFIG.listen || "0.0.0.0"
27
- puts "[Info - Server] Starting SiriProxy on #{listen_addr}:#{$APP_CONFIG.port}.."
27
+ puts "[Info - Server] Starting SiriProxy on #{listen_addr}:#{$APP_CONFIG.port}..."
28
28
  EventMachine::start_server(listen_addr, $APP_CONFIG.port, SiriProxy::Connection::Iphone, $APP_CONFIG.upstream_dns) { |conn|
29
29
  puts "[Info - Guzzoni] Starting conneciton #{conn.inspect}" if $LOG_LEVEL < 1
30
30
  conn.plugin_manager = SiriProxy::PluginManager.new()
31
31
  conn.plugin_manager.iphone_conn = conn
32
32
  }
33
+
34
+ retries = 0
35
+ while $APP_CONFIG.server_ip && !$SP_DNS_STARTED && retries <= 5
36
+ puts "[Info - Server] DNS server is not running yet, waiting #{2**retries} second#{'s' if retries > 0}..."
37
+ sleep 2**retries
38
+ retries += 1
39
+ end
40
+
41
+ if retries > 5
42
+ puts "[Error - Server] DNS server did not start up."
43
+ exit 1
44
+ end
45
+
46
+ EventMachine.set_effective_user($APP_CONFIG.user) if $APP_CONFIG.user
33
47
  puts "[Info - Server] SiriProxy up and running."
48
+
34
49
  rescue RuntimeError => err
35
50
  if err.message == "no acceptor"
36
51
  raise "[Error - Server] Cannot start the server on port #{$APP_CONFIG.port} - are you root, or have another process on this port already?"
@@ -38,9 +53,6 @@ class SiriProxy
38
53
  raise
39
54
  end
40
55
  end
41
-
42
- EventMachine.set_effective_user($APP_CONFIG.user) if $APP_CONFIG.user
43
-
44
56
  end
45
57
  end
46
58
  end
@@ -23,9 +23,11 @@ class SiriProxy::Dns
23
23
  @thread = Thread.new {
24
24
  begin
25
25
  self.run(log_level)
26
+ $SP_DNS_STARTED = true
26
27
  rescue RuntimeError => e
27
28
  if e.message.match /^no acceptor/
28
- puts "[Error - Server] You must be root to run the DNS server, DNS server is disabled"
29
+ puts "[Error - Server] Either you're not root or tcp/udp port 53 is in use. DNS server is disabled"
30
+ $SP_DNS_STARTED = true #Yeah, it didn't start, but we don't want to sit around and wait for it.
29
31
  else
30
32
  puts "[Error - Server] DNS Error: #{e.message}"
31
33
  puts "[Error - Server] DNS Server has crashed. Terminating SiriProxy"
@@ -1,3 +1,3 @@
1
1
  class SiriProxy
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: siriproxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-03-10 00:00:00.000000000 Z
14
+ date: 2013-03-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: CFPropertyList