|
4 | 4 | "flag" |
5 | 5 | "fmt" |
6 | 6 | "path" |
| 7 | + "syscall" |
7 | 8 |
|
8 | 9 | "github.com/quickfixgo/enum" |
9 | 10 | "github.com/quickfixgo/field" |
@@ -59,10 +60,10 @@ func (e *executor) genExecID() field.ExecIDField { |
59 | 60 | } |
60 | 61 |
|
61 | 62 | //quickfix.Application interface |
62 | | -func (e executor) OnCreate(sessionID quickfix.SessionID) { return } |
63 | | -func (e executor) OnLogon(sessionID quickfix.SessionID) { return } |
64 | | -func (e executor) OnLogout(sessionID quickfix.SessionID) { return } |
65 | | -func (e executor) ToAdmin(msg *quickfix.Message, sessionID quickfix.SessionID) { return } |
| 63 | +func (e executor) OnCreate(sessionID quickfix.SessionID) {} |
| 64 | +func (e executor) OnLogon(sessionID quickfix.SessionID) {} |
| 65 | +func (e executor) OnLogout(sessionID quickfix.SessionID) {} |
| 66 | +func (e executor) ToAdmin(msg *quickfix.Message, sessionID quickfix.SessionID) {} |
66 | 67 | func (e executor) ToApp(msg *quickfix.Message, sessionID quickfix.SessionID) error { return nil } |
67 | 68 | func (e executor) FromAdmin(msg *quickfix.Message, sessionID quickfix.SessionID) quickfix.MessageRejectError { |
68 | 69 | return nil |
@@ -123,7 +124,10 @@ func (e *executor) OnFIX40NewOrderSingle(msg fix40nos.NewOrderSingle, sessionID |
123 | 124 | } |
124 | 125 | execReport.SetClOrdID(clOrdID) |
125 | 126 |
|
126 | | - quickfix.SendToTarget(execReport, sessionID) |
| 127 | + sendErr := quickfix.SendToTarget(execReport, sessionID) |
| 128 | + if sendErr != nil { |
| 129 | + fmt.Println(sendErr) |
| 130 | + } |
127 | 131 |
|
128 | 132 | return nil |
129 | 133 | } |
@@ -179,8 +183,10 @@ func (e *executor) OnFIX41NewOrderSingle(msg fix41nos.NewOrderSingle, sessionID |
179 | 183 | } |
180 | 184 | execReport.SetClOrdID(clOrdID) |
181 | 185 |
|
182 | | - quickfix.SendToTarget(execReport, sessionID) |
183 | | - |
| 186 | + sendErr := quickfix.SendToTarget(execReport, sessionID) |
| 187 | + if sendErr != nil { |
| 188 | + fmt.Println(sendErr) |
| 189 | + } |
184 | 190 | return |
185 | 191 | } |
186 | 192 |
|
@@ -245,7 +251,10 @@ func (e *executor) OnFIX42NewOrderSingle(msg fix42nos.NewOrderSingle, sessionID |
245 | 251 | execReport.SetAccount(acct) |
246 | 252 | } |
247 | 253 |
|
248 | | - quickfix.SendToTarget(execReport, sessionID) |
| 254 | + sendErr := quickfix.SendToTarget(execReport, sessionID) |
| 255 | + if sendErr != nil { |
| 256 | + fmt.Println(sendErr) |
| 257 | + } |
249 | 258 |
|
250 | 259 | return |
251 | 260 | } |
@@ -309,7 +318,10 @@ func (e *executor) OnFIX43NewOrderSingle(msg fix43nos.NewOrderSingle, sessionID |
309 | 318 | execReport.SetAccount(acct) |
310 | 319 | } |
311 | 320 |
|
312 | | - quickfix.SendToTarget(execReport, sessionID) |
| 321 | + sendErr := quickfix.SendToTarget(execReport, sessionID) |
| 322 | + if sendErr != nil { |
| 323 | + fmt.Println(sendErr) |
| 324 | + } |
313 | 325 |
|
314 | 326 | return |
315 | 327 | } |
@@ -374,7 +386,10 @@ func (e *executor) OnFIX44NewOrderSingle(msg fix44nos.NewOrderSingle, sessionID |
374 | 386 | execReport.SetAccount(acct) |
375 | 387 | } |
376 | 388 |
|
377 | | - quickfix.SendToTarget(execReport, sessionID) |
| 389 | + sendErr := quickfix.SendToTarget(execReport, sessionID) |
| 390 | + if sendErr != nil { |
| 391 | + fmt.Println(sendErr) |
| 392 | + } |
378 | 393 |
|
379 | 394 | return |
380 | 395 | } |
@@ -439,7 +454,10 @@ func (e *executor) OnFIX50NewOrderSingle(msg fix50nos.NewOrderSingle, sessionID |
439 | 454 | execReport.SetAccount(acct) |
440 | 455 | } |
441 | 456 |
|
442 | | - quickfix.SendToTarget(execReport, sessionID) |
| 457 | + sendErr := quickfix.SendToTarget(execReport, sessionID) |
| 458 | + if sendErr != nil { |
| 459 | + fmt.Println(sendErr) |
| 460 | + } |
443 | 461 |
|
444 | 462 | return |
445 | 463 | } |
@@ -479,8 +497,8 @@ func main() { |
479 | 497 | return |
480 | 498 | } |
481 | 499 |
|
482 | | - interrupt := make(chan os.Signal) |
483 | | - signal.Notify(interrupt, os.Interrupt, os.Kill) |
| 500 | + interrupt := make(chan os.Signal, 1) |
| 501 | + signal.Notify(interrupt, os.Interrupt, syscall.SIGTERM) |
484 | 502 | <-interrupt |
485 | 503 |
|
486 | 504 | acceptor.Stop() |
|
0 commit comments