phut 0.6.3 → 0.6.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4760c8bc9db6a1b1f752aa738aa5eb844c8059e4
4
- data.tar.gz: f5d34bbee5fdeb48167a8e7f2170a2193fbe073c
3
+ metadata.gz: 75625e8cb54acd2d9b2f0203ab25c58023fff30f
4
+ data.tar.gz: 258addd7917000406f9ecfd38dd9fb65760432a0
5
5
  SHA512:
6
- metadata.gz: 45d1513fcbbeba14e3b8f83c3d3842350721db909edaaa24d42e6dbce603957f8b90fa4701690086cdae7864c187f996c852db7163d4860342fc7c757a523aaf
7
- data.tar.gz: 68877bd84eb271c7e54a0bec0e2860a0b1239f0a45ae55389f564531b8ae1db4721acde1a223b69c8a6ec4994b1a904d0a4a47e306cfaa5214e2af710bc7d6f2
6
+ metadata.gz: e9a8f348e6014413d9ebd5633e2c8fcc1434f6a0d3164817b25dc5597b1653e6a7b9513c0dd309e18e96b55abee030a13b37027e042b09bfa161928e81bda661
7
+ data.tar.gz: 965d8c4d03911757c8ab1b44bc6757a1516ba661be129e4a11016345a6177bf3a014a8f9277c2d996db24d42785dc225dd432d09627c8337ffcc53b420d3349a
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  ## develop (unreleased)
4
4
 
5
5
 
6
+ ## 0.6.4 (6/4/2015)
7
+ ### Bugs fixed
8
+ * [#24](https://github.com/trema/phut/pull/24): vhost should not exit
9
+ if the link to which the vhost is connected is disabled.
10
+
11
+
6
12
  ## 0.6.3 (6/4/2015)
7
13
  ### Bugs fixed
8
14
  * [#23](https://github.com/trema/phut/pull/23): Fix vhost restart failure.
data/lib/phut/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # Base module.
2
2
  module Phut
3
- VERSION = '0.6.3'
3
+ VERSION = '0.6.4'
4
4
  end
@@ -68,6 +68,9 @@ module Phut
68
68
  def write_to_raw_socket(packet)
69
69
  @packets_sent << packet.snapshot
70
70
  raw_socket.write packet.to_binary_s
71
+ rescue Errno::ENXIO
72
+ # link is disconnected
73
+ true
71
74
  end
72
75
 
73
76
  def create_udp_packet(dest)
@@ -81,17 +84,24 @@ module Phut
81
84
  "#{@options.fetch(:log_dir)}/vhost.#{@options.fetch(:name)}.log"
82
85
  end
83
86
 
87
+ # rubocop:disable MethodLength
84
88
  def read_loop
85
89
  loop do
86
- raw_data, = raw_socket.recvfrom(8192)
87
- udp = Pio::Udp.read(raw_data)
88
- unless @options[:promisc]
89
- next if udp.ip_destination_address != @options.fetch(:ip_address)
90
+ begin
91
+ raw_data, = raw_socket.recvfrom(8192)
92
+ udp = Pio::Udp.read(raw_data)
93
+ unless @options[:promisc]
94
+ next if udp.ip_destination_address != @options.fetch(:ip_address)
95
+ end
96
+ @logger.info "Received: #{udp}"
97
+ @packets_received << udp.snapshot
98
+ rescue Errno::ENETDOWN
99
+ # link is disconnected
100
+ sleep 1
90
101
  end
91
- @logger.info "Received: #{udp}"
92
- @packets_received << udp.snapshot
93
102
  end
94
103
  end
104
+ # rubocop:enable MethodLength
95
105
 
96
106
  def start_daemon
97
107
  Process.daemon
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhito Takamiya