em-simple_telnet 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/em-simple_telnet.rb +17 -7
  3. metadata +9 -13
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8c6445e29ec01de104b74ce36901f6ed5934de95
4
+ data.tar.gz: 70af3426609902b17bf906db0b0f0c48e1566c92
5
+ SHA512:
6
+ metadata.gz: 42179c6b4c6b34fb2c34a35ab51cfb8367331dfba113daffcaca8acd561cd5bccc3bc6d3efa615a1aecd031af8750affb1002135f4e866aa43dd40a0c2510ffc
7
+ data.tar.gz: 09081a250445833fc9f93196811b6f7deaece7b7352c7f3ffe5e1a058cc63ef3864d0de5295267ced6319c8b54a3a9a469fc14b25be485ce5da197d75d7ad956
@@ -515,10 +515,8 @@ class EventMachine::Protocols::SimpleTelnet < EventMachine::Connection
515
515
  ##
516
516
  # Called by EventMachine when data is received.
517
517
  #
518
- # The data is processed using #preprocess_telnet and appended to the
519
- # <tt>@input_buffer</tt>. The appended data is also logged using
520
- # #log_output. Then #check_input_buffer is called which checks the input
521
- # buffer for the prompt.
518
+ # The data is processed using #preprocess_telnet. The data then logged using
519
+ # #log_output. Then calls #process_payload.
522
520
  #
523
521
  def receive_data data
524
522
  if @telnet_options[:telnet_mode]
@@ -559,9 +557,21 @@ class EventMachine::Protocols::SimpleTelnet < EventMachine::Connection
559
557
  # in case only telnet sequences were received
560
558
  return if buf.empty?
561
559
 
560
+ log_output(buf, true)
561
+ process_payload(buf)
562
+ end
563
+
564
+ ##
565
+ # Appends _buf_ to the <tt>@input_buffer</tt>.
566
+ # Then cancels the @wait_time_timer if there was one.
567
+ # Does nothing else if there's no @connection_state_callback.
568
+ #
569
+ # Does some performance optimizations in case the input buffer is becoming
570
+ # huge and finally calls #check_input_buffer.
571
+ #
572
+ def process_payload(buf)
562
573
  # append output from server to input buffer and log it
563
574
  @input_buffer << buf
564
- log_output buf, true
565
575
 
566
576
  # cancel the timer for wait_time value because we received more data
567
577
  if @wait_time_timer
@@ -864,7 +874,7 @@ class EventMachine::Protocols::SimpleTelnet < EventMachine::Connection
864
874
  # #waitfor
865
875
  case @connection_state
866
876
  when :connecting
867
- @connection_state_callback.call(ConnectionFailed.new)
877
+ call_connection_state_callback(ConnectionFailed.new)
868
878
  when :waiting_for_prompt
869
879
  error = TimeoutError.new
870
880
 
@@ -874,7 +884,7 @@ class EventMachine::Protocols::SimpleTelnet < EventMachine::Connection
874
884
  end
875
885
  error.command = @last_command if @last_command
876
886
 
877
- @connection_state_callback.call(error)
887
+ call_connection_state_callback(error)
878
888
  end
879
889
  end
880
890
 
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-simple_telnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
5
- prerelease:
4
+ version: 0.0.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Patrik Wenger
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-11-21 00:00:00.000000000 Z
11
+ date: 2013-04-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: eventmachine
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 1.0.0.beta.2
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 1.0.0.beta.2
30
27
  description: This library provides a very simple way to connect to telnet servers
@@ -40,26 +37,25 @@ files:
40
37
  - README.rdoc
41
38
  homepage: http://github.com/paddor/em-simple_telnet
42
39
  licenses: []
40
+ metadata: {}
43
41
  post_install_message:
44
42
  rdoc_options: []
45
43
  require_paths:
46
44
  - lib
47
45
  required_ruby_version: !ruby/object:Gem::Requirement
48
- none: false
49
46
  requirements:
50
- - - ! '>='
47
+ - - '>='
51
48
  - !ruby/object:Gem::Version
52
49
  version: '0'
53
50
  required_rubygems_version: !ruby/object:Gem::Requirement
54
- none: false
55
51
  requirements:
56
- - - ! '>='
52
+ - - '>='
57
53
  - !ruby/object:Gem::Version
58
54
  version: '0'
59
55
  requirements: []
60
56
  rubyforge_project:
61
- rubygems_version: 1.8.23
57
+ rubygems_version: 2.0.0
62
58
  signing_key:
63
- specification_version: 3
59
+ specification_version: 4
64
60
  summary: Simple telnet client on EventMachine
65
61
  test_files: []