Skip to content

Commit c78dfd7

Browse files
author
Emile Joubert
committed
Support older compilers
and fix linebreaks and line endings
1 parent 10df9c3 commit c78dfd7

File tree

2 files changed

+51
-51
lines changed

2 files changed

+51
-51
lines changed

projects/client/RabbitMQ.Client/src/client/api/IModel.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,13 @@ uint QueueDelete(string queue,
333333
bool WaitForConfirms();
334334

335335
///<summary>Wait until all published messages have been confirmed.
336-
///</summary>
337-
///<returns>true if no nacks were received within the timeout,
338-
///otherwise false</returns>
339-
///<param name="timeout">How long to wait (at most) before returning
340-
///whether or not any nacks were returned</param>
341-
///<param name="timedOut">True if the method returned because
342-
///the timeout elapsed, not because all messages were ack'd
336+
///</summary>
337+
///<returns>true if no nacks were received within the timeout,
338+
///otherwise false</returns>
339+
///<param name="timeout">How long to wait (at most) before returning
340+
///whether or not any nacks were returned</param>
341+
///<param name="timedOut">True if the method returned because
342+
///the timeout elapsed, not because all messages were ack'd
343343
///or at least one nack'd.</param>
344344
///<remarks>
345345
///Waits until all messages published since the last call have
@@ -371,8 +371,8 @@ uint QueueDelete(string queue,
371371
///</summary>
372372
///<remarks>
373373
///Waits until all messages published since the last call have
374-
///been ack'd by the broker. If a nack is received or the timeout
375-
///elapses, throws an OperationInterrupedException exception
374+
///been ack'd by the broker. If a nack is received or the timeout
375+
///elapses, throws an OperationInterrupedException exception
376376
///immediately.
377377
///</remarks>
378378
[AmqpMethodDoNotImplement(null)]

projects/client/RabbitMQ.Client/src/client/impl/ModelBase.cs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -958,54 +958,54 @@ public void ConfirmSelect()
958958
_Private_ConfirmSelect(false);
959959
}
960960

961-
public bool WaitForConfirms(TimeSpan timeout, out bool timedOut)
962-
{
963-
var isWaitInfinite = (timeout.TotalMilliseconds == Timeout.Infinite);
964-
var stopwatch = Stopwatch.StartNew();
965-
lock (m_unconfirmedSet.SyncRoot)
966-
{
967-
while (true)
968-
{
969-
if (CloseReason != null)
970-
throw new AlreadyClosedException(CloseReason);
971-
972-
if (m_unconfirmedSet.Count == 0)
973-
{
974-
bool aux = m_onlyAcksReceived;
975-
m_onlyAcksReceived = true;
976-
timedOut = false;
977-
return aux;
978-
}
979-
if (isWaitInfinite)
980-
Monitor.Wait(m_unconfirmedSet.SyncRoot);
981-
else
982-
{
983-
var elapsed = stopwatch.Elapsed;
984-
if(elapsed > timeout || !Monitor.Wait(
985-
m_unconfirmedSet.SyncRoot, timeout - elapsed))
986-
{
987-
timedOut = true;
988-
return true;
989-
}
990-
}
991-
}
992-
}
961+
public bool WaitForConfirms(TimeSpan timeout, out bool timedOut)
962+
{
963+
bool isWaitInfinite = (timeout.TotalMilliseconds == Timeout.Infinite);
964+
Stopwatch stopwatch = Stopwatch.StartNew();
965+
lock (m_unconfirmedSet.SyncRoot)
966+
{
967+
while (true)
968+
{
969+
if (CloseReason != null)
970+
throw new AlreadyClosedException(CloseReason);
971+
972+
if (m_unconfirmedSet.Count == 0)
973+
{
974+
bool aux = m_onlyAcksReceived;
975+
m_onlyAcksReceived = true;
976+
timedOut = false;
977+
return aux;
978+
}
979+
if (isWaitInfinite)
980+
Monitor.Wait(m_unconfirmedSet.SyncRoot);
981+
else
982+
{
983+
TimeSpan elapsed = stopwatch.Elapsed;
984+
if(elapsed > timeout || !Monitor.Wait(
985+
m_unconfirmedSet.SyncRoot, timeout - elapsed))
986+
{
987+
timedOut = true;
988+
return true;
989+
}
990+
}
991+
}
992+
}
993993
}
994994

995995
public bool WaitForConfirms()
996-
{
997-
bool timedOut;
996+
{
997+
bool timedOut;
998998
return WaitForConfirms(TimeSpan.FromMilliseconds(Timeout.Infinite), out timedOut);
999999
}
10001000

1001-
public void WaitForConfirmsOrDie()
1002-
{
1003-
WaitForConfirmsOrDie(TimeSpan.FromMilliseconds(Timeout.Infinite));
1004-
}
1005-
1001+
public void WaitForConfirmsOrDie()
1002+
{
1003+
WaitForConfirmsOrDie(TimeSpan.FromMilliseconds(Timeout.Infinite));
1004+
}
1005+
10061006
public void WaitForConfirmsOrDie(TimeSpan timeout)
1007-
{
1008-
bool timedOut;
1007+
{
1008+
bool timedOut;
10091009
bool onlyAcksReceived = WaitForConfirms(timeout, out timedOut);
10101010
if (!onlyAcksReceived) {
10111011
Close(new ShutdownEventArgs(ShutdownInitiator.Application,
@@ -1017,7 +1017,7 @@ public void WaitForConfirmsOrDie(TimeSpan timeout)
10171017
if (timedOut) {
10181018
Close(new ShutdownEventArgs(ShutdownInitiator.Application,
10191019
CommonFraming.Constants.ReplySuccess,
1020-
"Timed out waiting for acks",
1020+
"Timed out waiting for acks",
10211021
new IOException("timed out waiting for acks")),
10221022
false);
10231023
throw new IOException("Timed out waiting for acks");

0 commit comments

Comments
 (0)