11package main
22
33import (
4+ "bytes"
45 "fmt"
56 "io/ioutil"
67 "log"
78 "os"
89 "os/signal"
910
1011 "github.com/quickfixgo/quickfix"
11- "github.com/quickfixgo/quickfix/gen/field"
12- "github.com/quickfixgo/quickfix/gen/tag"
12+ field "github.com/quickfixgo/quickfix/gen/field"
13+ tag "github.com/quickfixgo/quickfix/gen/tag"
1314)
1415
1516var router * quickfix.MessageRouter = quickfix .NewMessageRouter ()
@@ -57,7 +58,8 @@ func (e *EchoApplication) processMsg(msg *quickfix.Message, sessionID quickfix.S
5758 }
5859
5960 sessionOrderID := sessionID .String () + orderID .String ()
60- if possResend .FIXBoolean {
61+
62+ if bytes .Equal (possResend .Write (), []byte ("Y" )) {
6163 if e .OrderIds [sessionOrderID ] {
6264 return nil
6365 }
@@ -67,7 +69,7 @@ func (e *EchoApplication) processMsg(msg *quickfix.Message, sessionID quickfix.S
6769 }
6870
6971 reply := copyMessage (msg )
70- if possResend .FIXBoolean {
72+ if bytes . Equal ( possResend .Write (), [] byte ( "Y" )) {
7173 reply .Header .Set (possResend )
7274 }
7375
@@ -109,6 +111,7 @@ func main() {
109111 router .AddRoute (quickfix .ApplVerIDFIX50SP1 , "d" , app .processMsg )
110112 router .AddRoute (quickfix .ApplVerIDFIX50SP2 , "d" , app .processMsg )
111113
114+ fmt .Println ("starting test server" )
112115 cfg , err := os .Open (os .Args [1 ])
113116 if err != nil {
114117 fmt .Printf ("Error opening %v, %v\n " , os .Args [1 ], err )
@@ -139,9 +142,10 @@ func main() {
139142 return
140143 }
141144
142- interrupt := make (chan os.Signal )
143- signal .Notify (interrupt )
144- <- interrupt
145+ c := make (chan os.Signal , 1 )
146+ signal .Notify (c , os .Interrupt )
147+ <- c
148+ fmt .Println ("stopping test server" )
145149
146150 acceptor .Stop ()
147151}
0 commit comments