Skip to content

Commit 842010b

Browse files
authored
Merge branch 'main' into dependabot/go_modules/golang.org/x/net-0.17.0
2 parents efd5482 + a16527c commit 842010b

File tree

12 files changed

+128
-34
lines changed

12 files changed

+128
-34
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## 0.8.0 (October 25, 2023)
2+
3+
ENHANCEMENTS
4+
5+
* Remove tag from field map [GH 544]
6+
* Add message.Bytes() to avoid string conversion [GH 546]
7+
* Check RejectInvalidMessage on FIXT validation [GH 572]
8+
9+
BUG FIXES
10+
11+
* Fix repeating group read tags lost [GH 462]
12+
* Acceptance test result must be predictable [GH 578]
13+
* Makes event timer stop idempotent [GH 580, 581]
14+
* Added WaitGroup Wait in Initiator [GH 584]
15+
116
## 0.7.0 (January 2, 2023)
217

318
FEATURES

_test/ReflectorClient.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,15 @@ def @reflector.waitConnectAction(cid)
6767
end
6868

6969
def @reflector.waitDisconnectAction(cid)
70-
socket = @sockets[cid]
71-
if IO.select([socket], nil, nil, 10) == nil then
72-
raise "Connection hangs after ten seconds."
73-
elsif !socket.eof? then
74-
raise "Expected disconnection, got data"
70+
begin
71+
socket = @sockets[cid]
72+
if IO.select([socket], nil, nil, 10) == nil then
73+
raise "Connection hangs after ten seconds."
74+
elsif !socket.eof? then
75+
raise "Expected disconnection, got data"
76+
end
77+
rescue Errno::ECONNRESET
78+
# Ignore, server has already disconnected the socket
7579
end
7680
end
7781

_test/ReflectorServer.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ def @reflector.waitConnectAction(cid)
5858
end
5959

6060
def @reflector.waitDisconnectAction(cid)
61-
if IO.select([@socket], nil, nil, 10) == nil then
62-
raise "Connection hangs after five seconds."
63-
elsif !@socket.eof? then
64-
raise "Expected disconnection, got data"
61+
begin
62+
if IO.select([@socket], nil, nil, 10) == nil then
63+
raise "Connection hangs after five seconds."
64+
elsif !@socket.eof? then
65+
raise "Expected disconnection, got data"
66+
end
67+
rescue Errno::ECONNRESET
68+
# Ignore, client has already disconnected the socket
6569
end
6670
end
6771

datadictionary/datadictionary.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ func Parse(path string) (*DataDictionary, error) {
315315
func ParseSrc(xmlSrc io.Reader) (*DataDictionary, error) {
316316
doc := new(XMLDoc)
317317
decoder := xml.NewDecoder(xmlSrc)
318+
decoder.CharsetReader = func(encoding string, input io.Reader) (io.Reader, error) {
319+
return input, nil
320+
}
321+
318322
if err := decoder.Decode(doc); err != nil {
319323
return nil, errors.Wrapf(err, "problem parsing XML file")
320324
}

dialer.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package quickfix
1818
import (
1919
"fmt"
2020
"net"
21+
"time"
2122

2223
"golang.org/x/net/proxy"
2324

@@ -27,8 +28,16 @@ import (
2728
func loadDialerConfig(settings *SessionSettings) (dialer proxy.Dialer, err error) {
2829
stdDialer := &net.Dialer{}
2930
if settings.HasSetting(config.SocketTimeout) {
30-
if stdDialer.Timeout, err = settings.DurationSetting(config.SocketTimeout); err != nil {
31-
return
31+
timeout, err := settings.DurationSetting(config.SocketTimeout)
32+
if err != nil {
33+
timeoutInt, err := settings.IntSetting(config.SocketTimeout)
34+
if err != nil {
35+
return stdDialer, err
36+
}
37+
38+
stdDialer.Timeout = time.Duration(timeoutInt) * time.Second
39+
} else {
40+
stdDialer.Timeout = timeout
3241
}
3342
}
3443
dialer = stdDialer

filestore.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"os"
2323
"path"
2424
"strconv"
25+
"strings"
2526
"time"
2627

2728
"github.com/pkg/errors"
@@ -213,15 +214,15 @@ func (store *fileStore) populateCache() (creationTimePopulated bool, err error)
213214
}
214215

215216
if senderSeqNumBytes, err := ioutil.ReadFile(store.senderSeqNumsFname); err == nil {
216-
if senderSeqNum, err := strconv.Atoi(string(senderSeqNumBytes)); err == nil {
217+
if senderSeqNum, err := strconv.Atoi(strings.Trim(string(senderSeqNumBytes), "\r\n")); err == nil {
217218
if err = store.cache.SetNextSenderMsgSeqNum(senderSeqNum); err != nil {
218219
return creationTimePopulated, errors.Wrap(err, "cache set next sender")
219220
}
220221
}
221222
}
222223

223224
if targetSeqNumBytes, err := ioutil.ReadFile(store.targetSeqNumsFname); err == nil {
224-
if targetSeqNum, err := strconv.Atoi(string(targetSeqNumBytes)); err == nil {
225+
if targetSeqNum, err := strconv.Atoi(strings.Trim(string(targetSeqNumBytes), "\r\n")); err == nil {
225226
if err = store.cache.SetNextTargetMsgSeqNum(targetSeqNum); err != nil {
226227
return creationTimePopulated, errors.Wrap(err, "cache set next target")
227228
}

filestore_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ import (
1919
"fmt"
2020
"os"
2121
"path"
22+
"strconv"
2223
"strings"
2324
"testing"
2425
"time"
2526

27+
assert2 "github.com/stretchr/testify/assert"
2628
"github.com/stretchr/testify/require"
2729
"github.com/stretchr/testify/suite"
2830
)
@@ -62,3 +64,14 @@ func (suite *FileStoreTestSuite) TearDownTest() {
6264
func TestFileStoreTestSuite(t *testing.T) {
6365
suite.Run(t, new(FileStoreTestSuite))
6466
}
67+
68+
func TestStringParse(t *testing.T) {
69+
assert := assert2.New(t)
70+
i, err := strconv.Atoi(strings.Trim("00005\n", "\r\n"))
71+
assert.Nil(err)
72+
assert.Equal(5, i)
73+
74+
i, err = strconv.Atoi(strings.Trim("00006\r", "\r\n"))
75+
assert.Nil(err)
76+
assert.Equal(6, i)
77+
}

initiator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (i *Initiator) Start() (err error) {
6161
i.wg.Done()
6262
}(sessionID)
6363
}
64-
64+
i.wg.Wait()
6565
return
6666
}
6767

internal/event_timer.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type EventTimer struct {
1010
timer *time.Timer
1111
done chan struct{}
1212
wg sync.WaitGroup
13+
once sync.Once
1314
}
1415

1516
func NewEventTimer(task func()) *EventTimer {
@@ -45,7 +46,10 @@ func (t *EventTimer) Stop() {
4546
return
4647
}
4748

48-
close(t.done)
49+
t.once.Do(func() {
50+
close(t.done)
51+
})
52+
4953
t.wg.Wait()
5054
}
5155

internal/event_timer_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (c) quickfixengine.org All rights reserved.
2+
//
3+
// This file may be distributed under the terms of the quickfixengine.org
4+
// license as defined by quickfixengine.org and appearing in the file
5+
// LICENSE included in the packaging of this file.
6+
//
7+
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
8+
// THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A
9+
// PARTICULAR PURPOSE.
10+
//
11+
// See http://www.quickfixengine.org/LICENSE for licensing information.
12+
//
13+
// Contact [email protected] if any conditions of this licensing
14+
// are not clear to you.
15+
16+
package internal
17+
18+
import (
19+
"testing"
20+
)
21+
22+
func TestEventTimer_Stop_idempotent(*testing.T) {
23+
t := NewEventTimer(func() {})
24+
25+
t.Stop()
26+
t.Stop()
27+
}

0 commit comments

Comments
 (0)