Skip to content

Commit 8a0b626

Browse files
author
Simon MacMullen
committed
stable to default
2 parents dd14924 + 328efda commit 8a0b626

File tree

5 files changed

+85
-5
lines changed

5 files changed

+85
-5
lines changed

.hgignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ rabbit\.snk$
2525
^\_UpgradeReport\_Files/
2626
^gensrc/
2727
^projects/.*/.*\.csproj\.user$
28-
^projects/client/Unit/TestResult\.xml$
28+
TestResult\.xml$
2929

3030
^docs/pyle\.log$
3131
^build/

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private bool CertificateValidationCallback(object sender,
8787

8888
///<summary>Upgrade a Tcp stream to an Ssl stream using the SSL options
8989
///provided</summary>
90-
public static Stream TcpUpgrade(Stream tcpStream, SslOption sslOption)
90+
public static Stream TcpUpgrade(Stream tcpStream, SslOption sslOption, int timeout)
9191
{
9292
SslHelper helper = new SslHelper(sslOption);
9393
SslStream sslStream = new SslStream(tcpStream, false,
@@ -98,6 +98,8 @@ public static Stream TcpUpgrade(Stream tcpStream, SslOption sslOption)
9898
sslOption.Certs,
9999
sslOption.Version,
100100
false);
101+
sslStream.ReadTimeout = timeout;
102+
sslStream.WriteTimeout = timeout;
101103

102104
return sslStream;
103105
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public abstract class ModelBase : IFullModel
7575
public ManualResetEvent m_flowControlBlock = new ManualResetEvent(true);
7676
private readonly object m_flowSendLock = new object();
7777

78-
private ulong m_nextPubSeqNo;
78+
private ulong m_nextPubSeqNo = 0;
7979
private SynchronizedCollection<ulong> m_unconfirmedSet =
8080
new SynchronizedCollection<ulong>();
8181
private bool m_onlyAcksReceived = true;
@@ -970,7 +970,10 @@ public abstract uint _Private_QueueDelete(string queue,
970970

971971
public void ConfirmSelect()
972972
{
973-
m_nextPubSeqNo = 1;
973+
if (m_nextPubSeqNo == 0UL)
974+
{
975+
m_nextPubSeqNo = 1;
976+
}
974977
_Private_ConfirmSelect(false);
975978
}
976979

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public SocketFrameHandler_0_9(AmqpTcpEndpoint endpoint,
9292
{
9393
try
9494
{
95-
netstream = SslHelper.TcpUpgrade(netstream, endpoint.Ssl);
95+
netstream = SslHelper.TcpUpgrade(netstream, endpoint.Ssl, timeout);
9696
}
9797
catch (Exception)
9898
{
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 1.1.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (C) 2007-2013 GoPivotal, Inc.
8+
//
9+
// Licensed under the Apache License, Version 2.0 (the "License");
10+
// you may not use this file except in compliance with the License.
11+
// You may obtain a copy of the License at
12+
//
13+
// http://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing, software
16+
// distributed under the License is distributed on an "AS IS" BASIS,
17+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
// See the License for the specific language governing permissions and
19+
// limitations under the License.
20+
//---------------------------------------------------------------------------
21+
//
22+
// The MPL v1.1:
23+
//
24+
//---------------------------------------------------------------------------
25+
// The contents of this file are subject to the Mozilla Public License
26+
// Version 1.1 (the "License"); you may not use this file except in
27+
// compliance with the License. You may obtain a copy of the License
28+
// at http://www.mozilla.org/MPL/
29+
//
30+
// Software distributed under the License is distributed on an "AS IS"
31+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
32+
// the License for the specific language governing rights and
33+
// limitations under the License.
34+
//
35+
// The Original Code is RabbitMQ.
36+
//
37+
// The Initial Developer of the Original Code is GoPivotal, Inc.
38+
// Copyright (c) 2007-2013 GoPivotal, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
using NUnit.Framework;
42+
43+
using System;
44+
using System.Text;
45+
46+
namespace RabbitMQ.Client.Unit {
47+
[TestFixture]
48+
public class TestConfirmSelect : IntegrationFixture {
49+
protected UTF8Encoding enc = new UTF8Encoding();
50+
51+
[Test]
52+
public void TestConfirmSelectIdempotency()
53+
{
54+
Model.ConfirmSelect();
55+
Assert.AreEqual(1, Model.NextPublishSeqNo);
56+
Publish();
57+
Assert.AreEqual(2, Model.NextPublishSeqNo);
58+
Publish();
59+
Assert.AreEqual(3, Model.NextPublishSeqNo);
60+
61+
Model.ConfirmSelect();
62+
Publish();
63+
Assert.AreEqual(4, Model.NextPublishSeqNo);
64+
Publish();
65+
Assert.AreEqual(5, Model.NextPublishSeqNo);
66+
Publish();
67+
Assert.AreEqual(6, Model.NextPublishSeqNo);
68+
}
69+
70+
protected void Publish()
71+
{
72+
Model.BasicPublish("", "amq.fanout", null, enc.GetBytes("message"));
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)