Skip to content

Commit

Permalink
Merge branch '1.4.0beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
gbirchmeier committed Mar 7, 2013
2 parents e2a41dc + 4e3d9be commit c18c0bd
Show file tree
Hide file tree
Showing 25 changed files with 891 additions and 234 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ QuickFIXn.sln.cache
ChangeLog
*.swp
AcceptanceTest/AcceptanceTests*.html
AcceptanceTest/AcceptanceTests*.xml
AcceptanceTest/TestResult.xml
AcceptanceTest/bin/Debug/*
AcceptanceTest/bin/Release/*
Expand Down
9 changes: 8 additions & 1 deletion AcceptanceTest/Reflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ def identifyMessage(message)
def processFile(messages)
lineNum = 0
messages.each_line do
| line |
| fooline |

#utf = String.new(fooline)
#puts "UTF8: " + utf.force_encoding("UTF-8")

line = fooline.force_encoding("ASCII-8BIT")
#puts "ASCI: " + line

lineNum += 1
line.chomp!
if line.empty? then
Expand Down
2 changes: 1 addition & 1 deletion AcceptanceTest/Runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def createProcess(file, address, port)
print "<at>\n"
newarray.each do
| v |
file = File.open(v, "r")
file = File.open(v, "rb")
process = createProcess(file, ARGV[0], ARGV[1])
if process.nil? then
print " <test name='", v, "' result='", "failure' >\n"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# International chars in test

# for reference:
# http://en.wikipedia.org/wiki/UTF-8
# http://vim.wikia.com/wiki/Entering_special_characters
# http://vimdoc.sourceforge.net/htmldoc/digraph.html

iCONNECT
# logon message and response
I8=FIX.4.435=A34=149=TW52=<TIME>56=ISLD98=0108=2
E8=FIX.4.49=6035=A34=149=ISLD52=00000000-00:00:00.00056=TW98=0108=210=0

# for reference:
# http://en.wikipedia.org/wiki/UTF-8
# http://vim.wikia.com/wiki/Entering_special_characters
# http://vimdoc.sourceforge.net/htmldoc/digraph.html

#Send news with intl chars and receive echo
I8=FIX.4.435=B34=249=TW52=<TIME>56=ISLD347=UTF-8148=ole!359=olé!33=0
E8=FIX.4.49=8335=B34=249=ISLD52=00000000-00:00:00.00056=TW347=UTF-833=0148=ole!359=olé!10=69

# logout message and response
I8=FIX.4.435=534=349=TW52=<TIME>56=ISLD
E8=FIX.4.49=4935=534=349=ISLD52=00000000-00:00:00.00056=TW10=0

7 changes: 0 additions & 7 deletions NEXT_VERSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,4 @@ Changes since the last version:
-------------------------------
* (major/minor/patch) desc of fixed issue (contributor)

* (minor) issue #101 - better exception for when group doesn't use proper delimiter (gbirchmeier)
* (minor) issue #28 - rename interfaces to start with "I" (gbirchmeier)
* (patch) issue #128 - simplify/improve TradeClient example app (gbirchmeier)
* (minor) issue #135 - fix DateOnly/TimeOnly field support (formator)
* (patch) issue #134 - if DD field/group/component is missing "required" attribute, treat it as "required=N" (gbirchmeier)
* (patch) issue #114 - enum dupe-check script; corrections to FIX43 tag 574/MatchType (gbirchmeier)
* (patch) scripts and fixes for experimental Mono support (mgatny)

9 changes: 7 additions & 2 deletions QuickFIXn/AbstractInitiator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,13 @@ protected void Connect()
foreach(SessionID sessionID in disconnectedSessions)
{
Session session = Session.LookupSession(sessionID);
if(session.IsEnabled && session.IsSessionTime)
DoConnect(sessionID, settings_.Get(sessionID));
if (session.IsEnabled)
{
if (session.IsNewSession)
session.Reset("New session");
if (session.IsSessionTime)
DoConnect(sessionID, settings_.Get(sessionID));
}
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions QuickFIXn/Fields/FieldBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public override int getLength()
{
if (_changed)
makeStringFields();

return _stringField.Length + 1; // +1 for SOH
return System.Text.Encoding.UTF8.GetByteCount(_stringField) + 1; // +1 for SOH
}

/// <summary>
Expand All @@ -85,9 +84,10 @@ public override int getTotal()
makeStringFields();

int sum = 0;
foreach (char c in _stringField)
byte[] array = System.Text.Encoding.UTF8.GetBytes(_stringField);
foreach (byte b in array)
{
sum += (int)c;
sum += b;
}
return (sum + 1); // +1 for SOH
}
Expand Down
85 changes: 61 additions & 24 deletions QuickFIXn/FileStore.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using QuickFix.Util;

namespace QuickFix
{
Expand All @@ -24,10 +25,10 @@ public MsgDef(long index, int size)
private string seqNumsFileName_;
private string msgFileName_;
private string headerFileName_;
private string sessionFileName_;

private System.IO.FileStream seqNumsFile_;
private System.IO.FileStream msgFile_;

private System.IO.StreamWriter headerFile_;

private MemoryStore cache_ = new MemoryStore();
Expand Down Expand Up @@ -64,40 +65,52 @@ public FileStore(string path, SessionID sessionID)
seqNumsFileName_ = System.IO.Path.Combine(path, prefix + ".seqnums");
msgFileName_ = System.IO.Path.Combine(path, prefix + ".body");
headerFileName_ = System.IO.Path.Combine(path, prefix + ".header");
sessionFileName_ = System.IO.Path.Combine(path, prefix + ".session");

open();
}

private void open()
{
ConstructFromFileCache();
InitializeSessionCreateTime();

seqNumsFile_ = new System.IO.FileStream(seqNumsFileName_, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
msgFile_ = new System.IO.FileStream(msgFileName_, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
headerFile_ = new System.IO.StreamWriter(headerFileName_, true);
}

private void PurgeFileCache()
private void PurgeSingleFile(System.IO.Stream stream, string filename)
{
if (seqNumsFile_ != null)
seqNumsFile_.Close();

if (msgFile_ != null)
msgFile_.Close();

if (headerFile_ != null)
headerFile_.Close();
if (stream != null)
stream.Close();
if (System.IO.File.Exists(filename))
System.IO.File.Delete(filename);
}

if (System.IO.File.Exists(seqNumsFileName_))
System.IO.File.Delete(seqNumsFileName_);
private void PurgeSingleFile(System.IO.StreamWriter stream, string filename)
{
if (stream != null)
stream.Close();
if (System.IO.File.Exists(filename))
System.IO.File.Delete(filename);
}

if (System.IO.File.Exists(headerFileName_))
System.IO.File.Delete(headerFileName_);
private void PurgeSingleFile(string filename)
{
if (System.IO.File.Exists(filename))
System.IO.File.Delete(filename);
}

if (System.IO.File.Exists(msgFileName_))
System.IO.File.Delete(msgFileName_);
private void PurgeFileCache()
{
PurgeSingleFile(seqNumsFile_, seqNumsFileName_);
PurgeSingleFile(msgFile_, msgFileName_);
PurgeSingleFile(headerFile_, headerFileName_);
PurgeSingleFile(sessionFileName_);
}


private void ConstructFromFileCache()
{
offsets_.Clear();
Expand Down Expand Up @@ -132,11 +145,34 @@ private void ConstructFromFileCache()
}
}


private void InitializeSessionCreateTime()
{
if (System.IO.File.Exists(sessionFileName_) && new System.IO.FileInfo(sessionFileName_).Length > 0)
{
using (System.IO.StreamReader reader = new System.IO.StreamReader(sessionFileName_))
{
string s = reader.ReadToEnd();
cache_.CreationTime = UtcDateTimeSerializer.FromString(s);
}
}
else
{
using (System.IO.StreamWriter writer = new System.IO.StreamWriter(sessionFileName_, false))
{
writer.Write(UtcDateTimeSerializer.ToString(cache_.CreationTime.Value));
}
}
}


#region MessageStore Members

/// <summary>
/// Get messages within the range of sequence numbers
/// </summary>
/// <param name="startSeqNum"></param>
/// <param name="endSeqNum"></param>
/// <param name="messages"></param>
public void Get(int startSeqNum, int endSeqNum, List<string> messages)
{
for (int i = startSeqNum; i <= endSeqNum; i++)
Expand All @@ -152,7 +188,13 @@ public void Get(int startSeqNum, int endSeqNum, List<string> messages)
}

}


/// <summary>
/// Store a message
/// </summary>
/// <param name="msgSeqNum"></param>
/// <param name="msg"></param>
/// <returns></returns>
public bool Set(int msgSeqNum, string msg)
{
msgFile_.Seek(0, System.IO.SeekOrigin.End);
Expand Down Expand Up @@ -222,12 +264,7 @@ public DateTime? CreationTime
{
get
{
if (System.IO.File.Exists(seqNumsFileName_))
{
return System.IO.File.GetCreationTimeUtc(seqNumsFileName_);
}
else
return null;
return cache_.CreationTime;
}
}

Expand Down
6 changes: 2 additions & 4 deletions QuickFIXn/MemoryStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ public void IncrNextTargetMsgSeqNum()

public System.DateTime? CreationTime
{
get
{
return creationTime;
}
get { return creationTime; }
internal set { creationTime = value; }
}

[System.Obsolete("Use CreationTime instead")]
Expand Down
Loading

0 comments on commit c18c0bd

Please sign in to comment.