@@ -267,13 +267,15 @@ get_property(c::Connection, s::Symbol, default) = get(c.properties, s, default)
267
267
send (c:: MessageChannel , f, msgframes:: Vector = []) = send (c. conn, f, msgframes)
268
268
function send (c:: Connection , f, msgframes:: Vector = [])
269
269
# uncomment to enable synchronization (not required till we have preemptive tasks or threads)
270
+ @debug (" queing messageframes" , nframes= length (msgframes))
270
271
lck = take! (c. sendlck)
271
272
try
272
273
put! (c. sendq, TAMQPGenericFrame (f))
273
274
for m in msgframes
274
275
put! (c. sendq, TAMQPGenericFrame (m))
275
276
end
276
277
finally
278
+ @debug (" queued messageframes" , nqueued= length (c. sendq. data))
277
279
put! (c. sendlck, lck)
278
280
end
279
281
nothing
@@ -292,17 +294,25 @@ function send(c::MessageChannel, payload::TAMQPMethodPayload, msg::Union{Message
292
294
# send one or more message body frames
293
295
offset = 1
294
296
msglen = length (message. data)
297
+ framemax = c. conn. framemax
298
+ if framemax <= 0
299
+ errormsg = (c. conn. state == CONN_STATE_OPEN) ? " Unexpected framemax ($framemax ) value for connection" : " Connection closed"
300
+ throw (AMQPClientException (errormsg))
301
+ end
302
+
295
303
while offset <= msglen
296
- msgend = min (msglen, offset + c . conn . framemax - 1 )
304
+ msgend = min (msglen, offset + framemax - 1 )
297
305
bodypayload = TAMQPBodyPayload (message. data[offset: msgend])
298
306
offset = msgend + 1
307
+ @debug (" sending" , msglen, offset)
299
308
push! (msgframes, TAMQPContentBodyFrame (frameprop, bodypayload))
300
309
end
301
310
302
311
send (c, TAMQPMethodFrame (frameprop, payload), msgframes)
303
312
else
304
313
send (c, TAMQPMethodFrame (frameprop, payload))
305
314
end
315
+ @debug (" sent" , methodname= method_name (payload))
306
316
end
307
317
308
318
# ----------------------------------------
0 commit comments