sip2 0.2.2 → 0.2.3

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
  SHA256:
3
- metadata.gz: a1e096d30ed5962669bb45c1747f83339682f4a3fa8067e35301ea3a975de13c
4
- data.tar.gz: 7be6116ba6402c005ea78a0dc131dca72762cb593d083529b63dac82ed88de00
3
+ metadata.gz: 11edbd7e4605f2e348428819ca7045156eca4b95a34161c6a38b0aef0a3e7846
4
+ data.tar.gz: 854ee00429be13cc04ab99229dccdfc1a7055e106542d1e9c36c5f05a8d7b236
5
5
  SHA512:
6
- metadata.gz: 03ad63e45484c5cf767ba8f261b2b8b90155721b40d789d1d8b2418ad26396f768272a3584f987d628779bce09f83f39ac94d0ab04f109dc8c981340fabfd1c3
7
- data.tar.gz: 7c1e703837a65efd8c4fa02bad6f589fbc4e8f48d9d81627f90da31bf3f66fe7216704d448756c62e3159bfca7d2cf7d99566aba34797eaa562de6c7c8c63cd1
6
+ metadata.gz: 277765cd44b1086cda50dfb35393adaa25ff466e3c1cfb02ee2dd723471be68125b052b4741ab1178c6139c4c12571b31a95faa7d1fbc52058f075c676208fb2
7
+ data.tar.gz: 62016708c1636bf81aaf39fcab683c241a472339d28285411716414bcc57dbf1238cf97d2c8eab2de103f6c6e5d23fccb8a6a66eb90865bec3b27ccb287473fd
data/lib/sip2.rb CHANGED
@@ -15,8 +15,11 @@ require 'sip2/messages/status'
15
15
 
16
16
  module Sip2
17
17
  class TimeoutError < StandardError; end
18
+
18
19
  class ConnectionTimeout < TimeoutError; end
20
+
19
21
  class WriteTimeout < TimeoutError; end
22
+
20
23
  class ReadTimeout < TimeoutError; end
21
24
  end
22
25
 
@@ -16,7 +16,10 @@ module Sip2
16
16
  def send_message(message)
17
17
  message = with_checksum with_error_detection message
18
18
  write_with_timeout message
19
- response = read_with_timeout
19
+ # Read the response and strip any leading newline
20
+ # - Some ACS terminate messages with /r/n by mistake.
21
+ # We need to remove from the front (i.e. buffer remnant from the previous message)
22
+ response = read_with_timeout&.[](/\A\n?(.*)\z/, 1)
20
23
  response if sequence_and_checksum_valid? response
21
24
  ensure
22
25
  @sequence += 1
data/lib/sip2/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sip2
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sip2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - abrom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-11 00:00:00.000000000 Z
11
+ date: 2021-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.5'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.5'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rubocop-rspec
85
99
  requirement: !ruby/object:Gem::Requirement