@@ -44,107 +44,123 @@ public Model(bool dispatchAsync, int concurrency, ISession session) : base(dispa
44
44
45
45
public override void ConnectionTuneOk ( ushort channelMax , uint frameMax , ushort heartbeat )
46
46
{
47
- ModelSend ( new ConnectionTuneOk ( channelMax , frameMax , heartbeat ) ) ;
47
+ var cmd = new ConnectionTuneOk ( channelMax , frameMax , heartbeat ) ;
48
+ ModelSend ( ref cmd ) ;
48
49
}
49
50
50
51
public override void _Private_BasicCancel ( string consumerTag , bool nowait )
51
52
{
52
- ModelSend ( new BasicCancel ( consumerTag , nowait ) ) ;
53
+ var cmd = new BasicCancel ( consumerTag , nowait ) ;
54
+ ModelSend ( ref cmd ) ;
53
55
}
54
56
55
57
public override void _Private_BasicConsume ( string queue , string consumerTag , bool noLocal , bool autoAck , bool exclusive , bool nowait , IDictionary < string , object > arguments )
56
58
{
57
- ModelSend ( new BasicConsume ( queue , consumerTag , noLocal , autoAck , exclusive , nowait , arguments ) ) ;
59
+ var cmd = new BasicConsume ( queue , consumerTag , noLocal , autoAck , exclusive , nowait , arguments ) ;
60
+ ModelSend ( ref cmd ) ;
58
61
}
59
62
60
63
public override void _Private_BasicGet ( string queue , bool autoAck )
61
64
{
62
- ModelSend ( new BasicGet ( queue , autoAck ) ) ;
65
+ var cmd = new BasicGet ( queue , autoAck ) ;
66
+ ModelSend ( ref cmd ) ;
63
67
}
64
68
65
69
public override void _Private_BasicPublish ( string exchange , string routingKey , bool mandatory , IBasicProperties basicProperties , ReadOnlyMemory < byte > body )
66
70
{
67
- ModelSend ( new BasicPublish ( exchange , routingKey , mandatory , default ) , ( BasicProperties ) basicProperties , body ) ;
71
+ var cmd = new BasicPublish ( exchange , routingKey , mandatory , default ) ;
72
+ ModelSend ( ref cmd , ( BasicProperties ) basicProperties , body ) ;
68
73
}
69
74
70
75
public override void _Private_BasicPublishMemory ( ReadOnlyMemory < byte > exchange , ReadOnlyMemory < byte > routingKey , bool mandatory , IBasicProperties basicProperties , ReadOnlyMemory < byte > body )
71
76
{
72
- ModelSend ( new BasicPublishMemory ( exchange , routingKey , mandatory , default ) , ( BasicProperties ) basicProperties , body ) ;
77
+ var cmd = new BasicPublishMemory ( exchange , routingKey , mandatory , default ) ;
78
+ ModelSend ( ref cmd , ( BasicProperties ) basicProperties , body ) ;
73
79
}
74
80
75
81
public override void _Private_BasicRecover ( bool requeue )
76
82
{
77
- ModelSend ( new BasicRecover ( requeue ) ) ;
83
+ var cmd = new BasicRecover ( requeue ) ;
84
+ ModelSend ( ref cmd ) ;
78
85
}
79
86
80
87
public override void _Private_ChannelClose ( ushort replyCode , string replyText , ushort classId , ushort methodId )
81
88
{
82
- ModelSend ( new ChannelClose ( replyCode , replyText , classId , methodId ) ) ;
89
+ var cmd = new ChannelClose ( replyCode , replyText , classId , methodId ) ;
90
+ ModelSend ( ref cmd ) ;
83
91
}
84
92
85
93
public override void _Private_ChannelCloseOk ( )
86
94
{
87
- ModelSend ( new ChannelCloseOk ( ) ) ;
95
+ var cmd = new ChannelCloseOk ( ) ;
96
+ ModelSend ( ref cmd ) ;
88
97
}
89
98
90
99
public override void _Private_ChannelFlowOk ( bool active )
91
100
{
92
- ModelSend ( new ChannelFlowOk ( active ) ) ;
101
+ var cmd = new ChannelFlowOk ( active ) ;
102
+ ModelSend ( ref cmd ) ;
93
103
}
94
104
95
105
public override void _Private_ChannelOpen ( )
96
106
{
97
- ModelRpc ( new ChannelOpen ( ) , ProtocolCommandId . ChannelOpenOk ) ;
107
+ var cmd = new ChannelOpen ( ) ;
108
+ ModelRpc ( ref cmd , ProtocolCommandId . ChannelOpenOk ) ;
98
109
}
99
110
100
111
public override void _Private_ConfirmSelect ( bool nowait )
101
112
{
102
113
var method = new ConfirmSelect ( nowait ) ;
103
114
if ( nowait )
104
115
{
105
- ModelSend ( method ) ;
116
+ ModelSend ( ref method ) ;
106
117
}
107
118
else
108
119
{
109
- ModelRpc ( method , ProtocolCommandId . ConfirmSelectOk ) ;
120
+ ModelRpc ( ref method , ProtocolCommandId . ConfirmSelectOk ) ;
110
121
}
111
122
}
112
123
113
124
public override void _Private_ConnectionCloseOk ( )
114
125
{
115
- ModelSend ( new ConnectionCloseOk ( ) ) ;
126
+ var cmd = new ConnectionCloseOk ( ) ;
127
+ ModelSend ( ref cmd ) ;
116
128
}
117
129
118
130
public override void _Private_ConnectionOpen ( string virtualHost )
119
131
{
120
- ModelSend ( new ConnectionOpen ( virtualHost ) ) ;
132
+ var cmd = new ConnectionOpen ( virtualHost ) ;
133
+ ModelSend ( ref cmd ) ;
121
134
}
122
135
123
136
public override void _Private_ConnectionSecureOk ( byte [ ] response )
124
137
{
125
- ModelSend ( new ConnectionSecureOk ( response ) ) ;
138
+ var cmd = new ConnectionSecureOk ( response ) ;
139
+ ModelSend ( ref cmd ) ;
126
140
}
127
141
128
142
public override void _Private_ConnectionStartOk ( IDictionary < string , object > clientProperties , string mechanism , byte [ ] response , string locale )
129
143
{
130
- ModelSend ( new ConnectionStartOk ( clientProperties , mechanism , response , locale ) ) ;
144
+ var cmd = new ConnectionStartOk ( clientProperties , mechanism , response , locale ) ;
145
+ ModelSend ( ref cmd ) ;
131
146
}
132
147
133
148
public override void _Private_UpdateSecret ( byte [ ] newSecret , string reason )
134
149
{
135
- ModelRpc ( new ConnectionUpdateSecret ( newSecret , reason ) , ProtocolCommandId . ConnectionUpdateSecretOk ) ;
150
+ var cmd = new ConnectionUpdateSecret ( newSecret , reason ) ;
151
+ ModelRpc ( ref cmd , ProtocolCommandId . ConnectionUpdateSecretOk ) ;
136
152
}
137
153
138
154
public override void _Private_ExchangeBind ( string destination , string source , string routingKey , bool nowait , IDictionary < string , object > arguments )
139
155
{
140
156
ExchangeBind method = new ExchangeBind ( destination , source , routingKey , nowait , arguments ) ;
141
157
if ( nowait )
142
158
{
143
- ModelSend ( method ) ;
159
+ ModelSend ( ref method ) ;
144
160
}
145
161
else
146
162
{
147
- ModelRpc ( method , ProtocolCommandId . ExchangeBindOk ) ;
163
+ ModelRpc ( ref method , ProtocolCommandId . ExchangeBindOk ) ;
148
164
}
149
165
}
150
166
@@ -153,11 +169,11 @@ public override void _Private_ExchangeDeclare(string exchange, string type, bool
153
169
ExchangeDeclare method = new ExchangeDeclare ( exchange , type , passive , durable , autoDelete , @internal , nowait , arguments ) ;
154
170
if ( nowait )
155
171
{
156
- ModelSend ( method ) ;
172
+ ModelSend ( ref method ) ;
157
173
}
158
174
else
159
175
{
160
- ModelRpc ( method , ProtocolCommandId . ExchangeDeclareOk ) ;
176
+ ModelRpc ( ref method , ProtocolCommandId . ExchangeDeclareOk ) ;
161
177
}
162
178
}
163
179
@@ -166,11 +182,11 @@ public override void _Private_ExchangeDelete(string exchange, bool ifUnused, boo
166
182
ExchangeDelete method = new ExchangeDelete ( exchange , ifUnused , nowait ) ;
167
183
if ( nowait )
168
184
{
169
- ModelSend ( method ) ;
185
+ ModelSend ( ref method ) ;
170
186
}
171
187
else
172
188
{
173
- ModelRpc ( method , ProtocolCommandId . ExchangeDeleteOk ) ;
189
+ ModelRpc ( ref method , ProtocolCommandId . ExchangeDeleteOk ) ;
174
190
}
175
191
}
176
192
@@ -179,11 +195,11 @@ public override void _Private_ExchangeUnbind(string destination, string source,
179
195
ExchangeUnbind method = new ExchangeUnbind ( destination , source , routingKey , nowait , arguments ) ;
180
196
if ( nowait )
181
197
{
182
- ModelSend ( method ) ;
198
+ ModelSend ( ref method ) ;
183
199
}
184
200
else
185
201
{
186
- ModelRpc ( method , ProtocolCommandId . ExchangeUnbindOk ) ;
202
+ ModelRpc ( ref method , ProtocolCommandId . ExchangeUnbindOk ) ;
187
203
}
188
204
}
189
205
@@ -192,11 +208,11 @@ public override void _Private_QueueBind(string queue, string exchange, string ro
192
208
QueueBind method = new QueueBind ( queue , exchange , routingKey , nowait , arguments ) ;
193
209
if ( nowait )
194
210
{
195
- ModelSend ( method ) ;
211
+ ModelSend ( ref method ) ;
196
212
}
197
213
else
198
214
{
199
- ModelRpc ( method , ProtocolCommandId . QueueBindOk ) ;
215
+ ModelRpc ( ref method , ProtocolCommandId . QueueBindOk ) ;
200
216
}
201
217
}
202
218
@@ -205,11 +221,11 @@ public override void _Private_QueueDeclare(string queue, bool passive, bool dura
205
221
QueueDeclare method = new QueueDeclare ( queue , passive , durable , exclusive , autoDelete , nowait , arguments ) ;
206
222
if ( nowait )
207
223
{
208
- ModelSend ( method ) ;
224
+ ModelSend ( ref method ) ;
209
225
}
210
226
else
211
227
{
212
- ModelSend ( method ) ;
228
+ ModelSend ( ref method ) ;
213
229
}
214
230
}
215
231
@@ -218,48 +234,53 @@ public override uint _Private_QueueDelete(string queue, bool ifUnused, bool ifEm
218
234
QueueDelete method = new QueueDelete ( queue , ifUnused , ifEmpty , nowait ) ;
219
235
if ( nowait )
220
236
{
221
- ModelSend ( method ) ;
237
+ ModelSend ( ref method ) ;
222
238
return 0xFFFFFFFF ;
223
239
}
224
240
225
- return ModelRpc ( method , ProtocolCommandId . QueueDeleteOk , memory => new QueueDeleteOk ( memory . Span ) . _messageCount ) ;
241
+ return ModelRpc ( ref method , ProtocolCommandId . QueueDeleteOk , memory => new QueueDeleteOk ( memory . Span ) . _messageCount ) ;
226
242
}
227
243
228
244
public override uint _Private_QueuePurge ( string queue , bool nowait )
229
245
{
230
246
QueuePurge method = new QueuePurge ( queue , nowait ) ;
231
247
if ( nowait )
232
248
{
233
- ModelSend ( method ) ;
249
+ ModelSend ( ref method ) ;
234
250
return 0xFFFFFFFF ;
235
251
}
236
252
237
- return ModelRpc ( method , ProtocolCommandId . QueuePurgeOk , memory => new QueuePurgeOk ( memory . Span ) . _messageCount ) ;
253
+ return ModelRpc ( ref method , ProtocolCommandId . QueuePurgeOk , memory => new QueuePurgeOk ( memory . Span ) . _messageCount ) ;
238
254
}
239
255
240
256
public override void BasicAck ( ulong deliveryTag , bool multiple )
241
257
{
242
- ModelSend ( new BasicAck ( deliveryTag , multiple ) ) ;
258
+ var cmd = new BasicAck ( deliveryTag , multiple ) ;
259
+ ModelSend ( ref cmd ) ;
243
260
}
244
261
245
262
public override void BasicNack ( ulong deliveryTag , bool multiple , bool requeue )
246
263
{
247
- ModelSend ( new BasicNack ( deliveryTag , multiple , requeue ) ) ;
264
+ var cmd = new BasicNack ( deliveryTag , multiple , requeue ) ;
265
+ ModelSend ( ref cmd ) ;
248
266
}
249
267
250
268
public override void BasicQos ( uint prefetchSize , ushort prefetchCount , bool global )
251
269
{
252
- ModelRpc ( new BasicQos ( prefetchSize , prefetchCount , global ) , ProtocolCommandId . BasicQosOk ) ;
270
+ var cmd = new BasicQos ( prefetchSize , prefetchCount , global ) ;
271
+ ModelRpc ( ref cmd , ProtocolCommandId . BasicQosOk ) ;
253
272
}
254
273
255
274
public override void BasicRecoverAsync ( bool requeue )
256
275
{
257
- ModelSend ( new BasicRecoverAsync ( requeue ) ) ;
276
+ var cmd = new BasicRecoverAsync ( requeue ) ;
277
+ ModelSend ( ref cmd ) ;
258
278
}
259
279
260
280
public override void BasicReject ( ulong deliveryTag , bool requeue )
261
281
{
262
- ModelSend ( new BasicReject ( deliveryTag , requeue ) ) ;
282
+ var cmd = new BasicReject ( deliveryTag , requeue ) ;
283
+ ModelSend ( ref cmd ) ;
263
284
}
264
285
265
286
public override IBasicProperties CreateBasicProperties ( )
@@ -269,22 +290,26 @@ public override IBasicProperties CreateBasicProperties()
269
290
270
291
public override void QueueUnbind ( string queue , string exchange , string routingKey , IDictionary < string , object > arguments )
271
292
{
272
- ModelRpc ( new QueueUnbind ( queue , exchange , routingKey , arguments ) , ProtocolCommandId . QueueUnbindOk ) ;
293
+ var cmd = new QueueUnbind ( queue , exchange , routingKey , arguments ) ;
294
+ ModelRpc ( ref cmd , ProtocolCommandId . QueueUnbindOk ) ;
273
295
}
274
296
275
297
public override void TxCommit ( )
276
298
{
277
- ModelRpc ( new TxCommit ( ) , ProtocolCommandId . TxCommitOk ) ;
299
+ var cmd = new TxCommit ( ) ;
300
+ ModelRpc ( ref cmd , ProtocolCommandId . TxCommitOk ) ;
278
301
}
279
302
280
303
public override void TxRollback ( )
281
304
{
282
- ModelRpc ( new TxRollback ( ) , ProtocolCommandId . TxRollbackOk ) ;
305
+ var cmd = new TxRollback ( ) ;
306
+ ModelRpc ( ref cmd , ProtocolCommandId . TxRollbackOk ) ;
283
307
}
284
308
285
309
public override void TxSelect ( )
286
310
{
287
- ModelRpc ( new TxSelect ( ) , ProtocolCommandId . TxSelectOk ) ;
311
+ var cmd = new TxSelect ( ) ;
312
+ ModelRpc ( ref cmd , ProtocolCommandId . TxSelectOk ) ;
288
313
}
289
314
290
315
protected override bool DispatchAsynchronous ( in IncomingCommand cmd )
0 commit comments