em-simple_telnet 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/em-simple_telnet.rb +10 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf16b8d0ef409b504417bc283ebe89d5854657f1
|
4
|
+
data.tar.gz: 512db553a0cf00813a2c74b0261dfa9e7bdf96ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d40a5473dc45009bcc06fad1776bcbc49b4ac41a20285c8a3b9ba0e27ff87caa07167566fe255d9a6ac83259b07ea971a2d483fff7968d2f85a67771f188a69d
|
7
|
+
data.tar.gz: 0692dbe8c46fe79f08931f332670477dc341d8a61f1aab93ecc3d5d3ab12eba90b3bbf246995f1d07dfa6473fdcf799ad301d2dffd97a3822436347955646d46
|
data/lib/em-simple_telnet.rb
CHANGED
@@ -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
|
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
|
-
|
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
|
-
|
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.
|
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-
|
11
|
+
date: 2013-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|