em-simple_telnet 0.0.12 → 0.0.13

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/em-simple_telnet.rb +10 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 097196252f47ec670bb38a68bf67e9a82cda086e
4
- data.tar.gz: 998d986b4586a646f89454e66369879b43dcb596
3
+ metadata.gz: bf16b8d0ef409b504417bc283ebe89d5854657f1
4
+ data.tar.gz: 512db553a0cf00813a2c74b0261dfa9e7bdf96ea
5
5
  SHA512:
6
- metadata.gz: 1f09dbbd94dd961daee60b14b2f6d11571749dccef9105fde3df3a57caed6da8eb9d7530a12282175b8b407c08f51bd2a52a4d7210005889a003280f48b03d66
7
- data.tar.gz: 11c0526b61f3c9a5c8affe032eb2c1eee10e0333f238f816bee70fa89ed7b5e9c742e78a08d545fb349506e239209925c1f3301cc0e21296270e2d1a0661104c
6
+ metadata.gz: d40a5473dc45009bcc06fad1776bcbc49b4ac41a20285c8a3b9ba0e27ff87caa07167566fe255d9a6ac83259b07ea971a2d483fff7968d2f85a67771f188a69d
7
+ data.tar.gz: 0692dbe8c46fe79f08931f332670477dc341d8a61f1aab93ecc3d5d3ab12eba90b3bbf246995f1d07dfa6473fdcf799ad301d2dffd97a3822436347955646d46
@@ -210,7 +210,8 @@ class EventMachine::Protocols::SimpleTelnet < EventMachine::Connection
210
210
  # Merges DefaultOptions with _opts_. Establishes the connection to the
211
211
  # <tt>:host</tt> key using EventMachine.connect, logs in using #login and
212
212
  # passes the connection to the block provided. Closes the connection using
213
- # #close after the block terminates. The connection is then returned.
213
+ # #close after the block terminates, unless it's already #closed?. The
214
+ # connection is then returned.
214
215
  #
215
216
  def connect opts
216
217
  opts = DefaultOptions.merge opts
@@ -240,7 +241,7 @@ class EventMachine::Protocols::SimpleTelnet < EventMachine::Connection
240
241
  ensure
241
242
  # Use #close so a subclass can execute some kind of logout command
242
243
  # before the connection is closed.
243
- connection.close
244
+ connection.close unless connection.closed?
244
245
  end
245
246
  ensure
246
247
  # close the connection in any case
@@ -729,7 +730,9 @@ class EventMachine::Protocols::SimpleTelnet < EventMachine::Connection
729
730
  # Raises Errno::ENOTCONN in case the connection is closed (#unbind has been
730
731
  # called before). Also contains some debugging stuff depending on $DEBUG.
731
732
  def send_data(s)
732
- raise Errno::ENOTCONN, "Connection is already closed." if closed?
733
+ if closed?
734
+ raise Errno::ENOTCONN, "Can't send data: Connection is already closed."
735
+ end
733
736
  @last_sent_data = Time.now
734
737
  print_recently_received_data if $DEBUG
735
738
  warn "#{node}: Sending #{s.inspect}" if $DEBUG
@@ -995,7 +998,10 @@ class EventMachine::Protocols::SimpleTelnet < EventMachine::Connection
995
998
  # Sets the @connection_state to _new_state_. Raises if current (old) state is
996
999
  # :closed, because that can't be changed.
997
1000
  def connection_state=(new_state)
998
- raise Errno::ENOTCONN, "Connection is already closed." if closed?
1001
+ if closed?
1002
+ raise Errno::ENOTCONN,
1003
+ "Can't change connection state: Connection is already closed."
1004
+ end
999
1005
  @connection_state = new_state
1000
1006
  end
1001
1007
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-simple_telnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-24 00:00:00.000000000 Z
11
+ date: 2013-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine