Skip to content

Commit 6f35041

Browse files
author
Hubert Plociniczak
committed
Instead of checking the fields, test whether the method is an instance of ChannelCloseOk class.
1 parent de429e7 commit 6f35041

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

src/client/impl/v0_8/ProtocolBase.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ public override void CreateChannelClose(ushort reasonCode,
104104

105105
public override bool CanSendWhileClosed(Command cmd)
106106
{
107-
return (cmd.m_method.ProtocolClassId
108-
== RabbitMQ.Client.Framing.Impl.v0_8.ChannelCloseOk.ClassId)
109-
&& (cmd.m_method.ProtocolMethodId
110-
== RabbitMQ.Client.Framing.Impl.v0_8.ChannelCloseOk.MethodId);
107+
return cmd.m_method is RabbitMQ.Client.Framing.Impl.v0_8.ChannelCloseOk;
111108
}
112109
}
113110
}

src/client/impl/v0_8qpid/ProtocolBase.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ public override void CreateChannelClose(ushort reasonCode,
104104

105105
public override bool CanSendWhileClosed(Command cmd)
106106
{
107-
return (cmd.m_method.ProtocolClassId
108-
== RabbitMQ.Client.Framing.Impl.v0_8qpid.ChannelCloseOk.ClassId)
109-
&& (cmd.m_method.ProtocolMethodId
110-
== RabbitMQ.Client.Framing.Impl.v0_8qpid.ChannelCloseOk.MethodId);
107+
return cmd.m_method is RabbitMQ.Client.Framing.Impl.v0_8qpid.ChannelCloseOk;
111108
}
112109
}
113110
}

src/client/impl/v0_9/ProtocolBase.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ public override void CreateChannelClose(ushort reasonCode,
104104

105105
public override bool CanSendWhileClosed(Command cmd)
106106
{
107-
return (cmd.m_method.ProtocolClassId
108-
== RabbitMQ.Client.Framing.Impl.v0_9.ChannelCloseOk.ClassId)
109-
&& (cmd.m_method.ProtocolMethodId
110-
== RabbitMQ.Client.Framing.Impl.v0_9.ChannelCloseOk.MethodId);
107+
return cmd.m_method is RabbitMQ.Client.Framing.Impl.v0_9.ChannelCloseOk;
111108
}
112109
}
113110
}

0 commit comments

Comments
 (0)