acpc_table_manager 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae4c95c398a2a4e37af68c745df3a8cc01e497eb
4
- data.tar.gz: 9d943fd5ce79caa6954adab48d457ecc342b3282
3
+ metadata.gz: 1d70b98f25734162aa73784163ad9b0ad4e1da2f
4
+ data.tar.gz: 27922143aa8c9b314f5b9cdd3e1dc2e6a403ecf0
5
5
  SHA512:
6
- metadata.gz: a0d92d83354645d1ad473773bd5e84a967bf57997ee680e73dc295f895df4ceb653c8d9ed47514b9e66f9f19dbd10786634c0223607a34b6897a67a90afd20bc
7
- data.tar.gz: d76abf15aff63463c490c0d1d9b7b9c5437d61d63a2ea37520c983eb075e495d201573aa277b98130f83f9b97270e2b5cbe2bec51987bdb6f9c3a02429149a66
6
+ metadata.gz: 23681008e962526b537672c7db5ce846b626fae93629e85492df5d1f1db5cc562df324005df211dfacb739c99f716a7f30f647a4ced07a538ecac82463c9dcbd
7
+ data.tar.gz: c3a40095295e2136f4d06a2e364054dfcb90783be7ab20fd22d70a754ba5e4f164cb1458e11c3c2490e8f7c51c44b1d9433b7274fb08f527c770dad5d94c5dca
data/exe/acpc_proxy CHANGED
@@ -89,8 +89,8 @@ begin
89
89
  end
90
90
  match = AcpcTableManager::Match.find options[:match_id]
91
91
  if proxy.match_ended? or !match.dealer_running?
92
- match.proxy_pid = -1
93
- match.dealer_pid = -1
92
+ match.proxy_pid = nil
93
+ match.dealer_pid = nil
94
94
  match.save!
95
95
  exit
96
96
  end
@@ -49,11 +49,15 @@ class Match
49
49
 
50
50
  class << self
51
51
  # @todo Move to AcpcDealer
52
- def kill_process_if_running(pid)
53
- begin
52
+ def safe_kill(pid)
53
+ if pid && pid > 0
54
54
  AcpcDealer::kill_process pid
55
55
  sleep 1 # Give the process a chance to exit
56
-
56
+ end
57
+ end
58
+ def kill_process_if_running(pid)
59
+ begin
60
+ safe_kill pid
57
61
  if AcpcDealer::process_exists?(pid)
58
62
  AcpcDealer::force_kill_process pid
59
63
  sleep 1 # Give the process a chance to exit
@@ -216,8 +220,8 @@ class Match
216
220
  field :port_numbers, type: Array
217
221
  field :random_seed, type: Integer, default: new_random_seed
218
222
  field :last_slice_viewed, type: Integer, default: -1
219
- field :dealer_pid, type: Integer, default: -1
220
- field :proxy_pid, type: Integer, default: -1
223
+ field :dealer_pid, type: Integer, default: nil
224
+ field :proxy_pid, type: Integer, default: nil
221
225
  field :ready_to_start, type: Boolean, default: false
222
226
  field :unable_to_start_dealer, type: Boolean, default: false
223
227
  field :dealer_options, type: String, default: (
@@ -343,10 +347,10 @@ class Match
343
347
  def finished?() started? && self.slices.last.match_ended? end
344
348
  def running?() dealer_running? && proxy_running? end
345
349
  def dealer_running?
346
- self.dealer_pid >= 0 && AcpcDealer::process_exists?(self.dealer_pid)
350
+ self.dealer_pid && self.dealer_pid > 0 && AcpcDealer::process_exists?(self.dealer_pid)
347
351
  end
348
352
  def proxy_running?
349
- self.proxy_pid >= 0 && AcpcDealer::process_exists?(self.proxy_pid)
353
+ self.proxy_pid && self.proxy_pid > 0 && AcpcDealer::process_exists?(self.proxy_pid)
350
354
  end
351
355
  def all_slices_viewed?
352
356
  self.last_slice_viewed >= (self.slices.length - 1)
@@ -1,3 +1,3 @@
1
1
  module AcpcTableManager
2
- VERSION = "3.0.3"
2
+ VERSION = "3.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acpc_table_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill