Skip to content

Commit

Permalink
Merge pull request connamara#364 from gbirchmeier/nodefaultparam
Browse files Browse the repository at this point in the history
remove .NET 4.0 features (default params, named params)
  • Loading branch information
gbirchmeier committed Feb 1, 2016
2 parents 7719497 + b6e2293 commit 25c5962
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 17 deletions.
17 changes: 15 additions & 2 deletions QuickFIXn/Message/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,20 @@ public void FromString(string msgstr, bool validate, DataDictionary.DataDictiona
{
FromString(msgstr, validate, sessionDD, appDD, null);
}


/// <summary>
/// Create a Message from a FIX string
/// </summary>
/// <param name="msgstr"></param>
/// <param name="validate"></param>
/// <param name="sessionDD"></param>
/// <param name="appDD"></param>
/// <param name="msgFactory">If null, any groups will be constructed as generic Group objects</param>
public void FromString(string msgstr, bool validate,
DataDictionary.DataDictionary sessionDD, DataDictionary.DataDictionary appDD, IMessageFactory msgFactory)
{
FromString(msgstr, validate, sessionDD, appDD, msgFactory, false);
}

/// <summary>
/// Creates a Message from a FIX string
Expand All @@ -373,7 +386,7 @@ public void FromString(string msgstr, bool validate, DataDictionary.DataDictiona
/// </param>
public void FromString(string msgstr, bool validate,
DataDictionary.DataDictionary sessionDD, DataDictionary.DataDictionary appDD, IMessageFactory msgFactory,
bool ignoreBody=false)
bool ignoreBody)
{
Clear();

Expand Down
8 changes: 7 additions & 1 deletion QuickFIXn/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,13 @@ public bool GenerateHeartbeat(Message testRequest)
return SendRaw(heartbeat, 0);
}

internal bool GenerateReject(MessageBuilder msgBuilder, FixValues.SessionRejectReason reason, int field=0)

internal bool GenerateReject(MessageBuilder msgBuilder, FixValues.SessionRejectReason reason)
{
return GenerateReject(msgBuilder.RejectableMessage(), reason, 0);
}

internal bool GenerateReject(MessageBuilder msgBuilder, FixValues.SessionRejectReason reason, int field)
{
return GenerateReject(msgBuilder.RejectableMessage(), reason, field);
}
Expand Down
7 changes: 6 additions & 1 deletion QuickFIXn/SessionState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,12 @@ public void Get(int begSeqNo, int endSeqNo, List<string> messages)
}
}

public void SetResendRange(int begin, int end, int chunkEnd=-1)
public void SetResendRange(int begin, int end)
{
SetResendRange(begin, end, -1);
}

public void SetResendRange(int begin, int end, int chunkEnd)
{
resendRange_.BeginSeqNo = begin;
resendRange_.EndSeqNo = end;
Expand Down
2 changes: 1 addition & 1 deletion QuickFIXn/SocketInitiatorThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected int ReadSome(byte[] buffer, int timeoutMilliseconds)
{
// Begin read if it is not already started
if (currentReadRequest_ == null)
currentReadRequest_ = stream_.BeginRead(buffer, 0, buffer.Length, callback: null, state: null);
currentReadRequest_ = stream_.BeginRead(buffer, 0, buffer.Length, null, null);

// Wait for it to complete (given timeout)
currentReadRequest_.AsyncWaitHandle.WaitOne(timeoutMilliseconds);
Expand Down
4 changes: 2 additions & 2 deletions QuickFIXn/SocketReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void Read()
{
try
{
int bytesRead = ReadSome(readBuffer_, timeoutMilliseconds: 1000);
int bytesRead = ReadSome(readBuffer_, 1000);
if (bytesRead > 0)
parser_.AddToStream(System.Text.Encoding.UTF8.GetString(readBuffer_, 0, bytesRead));
else if (null != qfSession_)
Expand Down Expand Up @@ -79,7 +79,7 @@ protected virtual int ReadSome(byte[] buffer, int timeoutMilliseconds)
{
// Begin read if it is not already started
if (currentReadRequest_ == null)
currentReadRequest_ = stream_.BeginRead(buffer, 0, buffer.Length, callback: null, state: null);
currentReadRequest_ = stream_.BeginRead(buffer, 0, buffer.Length, null, null);

// Wait for it to complete (given timeout)
currentReadRequest_.AsyncWaitHandle.WaitOne(timeoutMilliseconds);
Expand Down
2 changes: 1 addition & 1 deletion QuickFIXn/SocketSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void Configure(QuickFix.Dictionary dictionary)
try
{
SslProtocol = (System.Security.Authentication.SslProtocols)
Enum.Parse(typeof(System.Security.Authentication.SslProtocols), protocolString, ignoreCase: true);
Enum.Parse(typeof(System.Security.Authentication.SslProtocols), protocolString, true);
}
catch (Exception)
{
Expand Down
12 changes: 3 additions & 9 deletions QuickFIXn/Transport/StreamFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static Stream CreateClientStream(IPEndPoint endpoint, SocketSettings sett
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.NoDelay = settings.SocketNodelay;
socket.Connect(endpoint);
Stream stream = new NetworkStream(socket, ownsSocket: true);
Stream stream = new NetworkStream(socket, true);

if (settings.UseSSL)
{
Expand Down Expand Up @@ -183,10 +183,7 @@ public SSLStreamFactory(ILog log, SocketSettings settings)
/// <returns>a ssl enabled stream</returns>
public Stream CreateClientStreamAndAuthenticate(Stream innerStream)
{
var sslStream = new SslStream(innerStream,
leaveInnerStreamOpen: false,
userCertificateValidationCallback: ValidateServerCertificate,
userCertificateSelectionCallback: SelectLocalCertificate);
var sslStream = new SslStream(innerStream, false, ValidateServerCertificate, SelectLocalCertificate);

try
{
Expand All @@ -213,10 +210,7 @@ public Stream CreateClientStreamAndAuthenticate(Stream innerStream)
/// <returns>a ssl enabled stream</returns>
public Stream CreateServerStreamAndAuthenticate(Stream innerStream)
{
var sslStream = new SslStream(innerStream,
leaveInnerStreamOpen: false,
userCertificateValidationCallback: ValidateClientCertificate,
userCertificateSelectionCallback: SelectLocalCertificate);
var sslStream = new SslStream(innerStream, false, ValidateClientCertificate, SelectLocalCertificate);

try
{
Expand Down

0 comments on commit 25c5962

Please sign in to comment.