Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various cleanups of Connection / Model #1009

Merged
merged 7 commits into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/RabbitMQ.Client/client/api/AmqpTimestamp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace RabbitMQ.Client
/// timestamps are signed or unsigned.
/// </para>
/// </remarks>
public struct AmqpTimestamp : IEquatable<AmqpTimestamp>
public readonly struct AmqpTimestamp : IEquatable<AmqpTimestamp>
{
/// <summary>
/// Construct an <see cref="AmqpTimestamp"/>.
Expand Down
17 changes: 0 additions & 17 deletions projects/RabbitMQ.Client/client/api/IConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,6 @@ public interface IConnection : INetworkConnection, IDisposable
/// </summary>
bool IsOpen { get; }

/// <summary>
/// Returns the known hosts that came back from the
/// broker in the connection.open-ok method at connection
/// startup time. Null until the connection is completely open and ready for use.
/// </summary>
AmqpTcpEndpoint[] KnownHosts { get; }

/// <summary>
/// The <see cref="IProtocol"/> this connection is using to communicate with its peer.
/// </summary>
Expand Down Expand Up @@ -224,15 +217,5 @@ public interface IConnection : INetworkConnection, IDisposable
/// Create and return a fresh channel, session, and model.
/// </summary>
IModel CreateModel();

/// <summary>
/// Handle incoming Connection.Blocked methods.
/// </summary>
void HandleConnectionBlocked(string reason);

/// <summary>
/// Handle incoming Connection.Unblocked methods.
/// </summary>
void HandleConnectionUnblocked();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ namespace RabbitMQ.Client.Exceptions
/// <summary>Thrown when the application tries to make use of a
/// session or connection that has already been shut
/// down.</summary>
#if !NETSTANDARD1_5
[Serializable]
#endif
public class AlreadyClosedException : OperationInterruptedException
{
///<summary>Construct an instance containing the given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ namespace RabbitMQ.Client.Exceptions
{
/// <summary> Thrown when the cause is an
/// authentication failure. </summary>
#if !NETSTANDARD1_5
[Serializable]
#endif
public class AuthenticationFailureException : PossibleAuthenticationFailureException
{
public AuthenticationFailureException(string msg) : base(msg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ namespace RabbitMQ.Client.Exceptions
{
///<summary>Thrown when no connection could be opened during a
///ConnectionFactory.CreateConnection attempt.</summary>
#if !NETSTANDARD1_5
[Serializable]
#endif
public class BrokerUnreachableException : IOException
{
///<summary>Construct a BrokerUnreachableException. The inner exception is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ namespace RabbitMQ.Client.Exceptions
/// <summary> Thrown when a SessionManager cannot allocate a new
/// channel number, or the requested channel number is already in
/// use. </summary>
#if !NETSTANDARD1_5
[Serializable]
#endif
public class ChannelAllocationException : ProtocolViolationException
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
namespace RabbitMQ.Client.Exceptions
{
/// <summary>Thrown when a connection to the broker fails</summary>
#if !NETSTANDARD1_5
[Serializable]
#endif
public class ConnectFailureException : ProtocolViolationException
{
public ConnectFailureException(string msg, Exception inner)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ namespace RabbitMQ.Client.Exceptions
/// operation, an OperationInterruptedException will be thrown to
/// the caller of IModel.QueueDeclare.
/// </summary>
#if !NETSTANDARD1_5
[Serializable]
#endif
public class OperationInterruptedException
// TODO: inherit from OperationCanceledException
: RabbitMQClientException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ namespace RabbitMQ.Client.Exceptions
///The peer's {'A','M','Q','P',txHi,txLo,major,minor} packet is
///decoded into instances of this class.
///</remarks>
#if !NETSTANDARD1_5
[Serializable]
#endif
public class PacketNotRecognizedException : RabbitMQClientException
{
///<summary>Fills the new instance's properties with the values passed in.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ namespace RabbitMQ.Client.Exceptions
{
/// <summary> Thrown when the likely cause is an
/// authentication failure. </summary>
#if !NETSTANDARD1_5
[Serializable]
#endif
public class PossibleAuthenticationFailureException : RabbitMQClientException
{
public PossibleAuthenticationFailureException(string msg, Exception inner) : base(msg, inner)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ namespace RabbitMQ.Client.Exceptions
///<summary>Thrown to indicate that the peer does not support the
///wire protocol version we requested immediately after opening
///the TCP socket.</summary>
#if !NETSTANDARD1_5
[Serializable]
#endif
public class ProtocolVersionMismatchException : ProtocolViolationException
{
///<summary>Fills the new instance's properties with the values passed in.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@

namespace RabbitMQ.Client.Exceptions
{
#if !NETSTANDARD1_5
[Serializable]
#endif
public class ProtocolViolationException : RabbitMQClientException
{
public ProtocolViolationException(string message) : base(message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@

namespace RabbitMQ.Client.Exceptions
{
#if !NETSTANDARD1_5
[Serializable]
#endif
public abstract class RabbitMQClientException : Exception
{
/// <summary>Initializes a new instance of the <see cref="RabbitMQClientException" /> class.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ namespace RabbitMQ.Client.Exceptions
{
/// <summary> Thrown when the wire-formatting code cannot encode a
/// particular .NET value to AMQP protocol format. </summary>
#if !NETSTANDARD1_5
[Serializable]
#endif
public class WireFormattingException : ProtocolViolationException
{
///<summary>Construct a WireFormattingException with no
Expand Down
7 changes: 1 addition & 6 deletions projects/RabbitMQ.Client/client/framing/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ public override void _Private_ConfirmSelect(bool nowait)
}
}

public override void _Private_ConnectionClose(ushort replyCode, string replyText, ushort classId, ushort methodId)
{
ModelRpc<ConnectionCloseOk>(new ConnectionClose(replyCode, replyText, classId, methodId));
}

public override void _Private_ConnectionCloseOk()
{
ModelSend(new ConnectionCloseOk());
Expand Down Expand Up @@ -298,7 +293,7 @@ public override void TxSelect()
ModelRpc<TxSelectOk>(new TxSelect());
}

public override bool DispatchAsynchronous(in IncomingCommand cmd)
protected override bool DispatchAsynchronous(in IncomingCommand cmd)
{
switch (cmd.Method.ProtocolCommandId)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ internal void DeleteRecordedExchange(string exchangeName)
}
}

public void DeleteAutoDeleteExchange(string exchangeName)
internal void DeleteAutoDeleteExchange(string exchangeName)
{
lock (_recordedEntitiesLock)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ private bool TryRecoverConnectionDelegate()
{
try
{
var defunctConnection = _delegate;
var defunctConnection = _innerConnection;
IFrameHandler fh = _endpoints.SelectOne(_factory.CreateFrameHandler);
_delegate = new Connection(_factory, fh, ClientProvidedName);
_delegate.TakeOver(defunctConnection);
_innerConnection = new Connection(_factory, fh, ClientProvidedName);
_innerConnection.TakeOver(defunctConnection);
return true;
}
catch (Exception e)
Expand Down
Loading