kgiusti commented on a change in pull request #694: DISPATCH-975: Enforce max
message size on message ingress
URL: https://github.com/apache/qpid-dispatch/pull/694#discussion_r387298396
##########
File path: src/router_node.c
##########
@@ -329,12 +330,33 @@ static bool AMQP_rx_handler(void* context, qd_link_t
*link)
qdr_delivery_t *delivery = qdr_node_delivery_qdr_from_pn(pnd);
bool next_delivery = false;
- //
- // Receive the message into a local representation.
- //
qd_message_t *msg = qd_message_receive(pnd);
+
+ int oversize = qd_message_exceeded_max_message_size(msg);
+ if (oversize > 0) {
+ // message is bigger than maxMessageSize
+ if (oversize == 1) {
+ // went oversize on this pass
+ qdr_link_t *rlink = (qdr_link_t*) qd_link_get_context(link);
+ qd_log(qd_policy_log_source(), QD_LOG_WARNING,
"[C%"PRIu64"][L%"PRIu64"] DENY AMQP Transfer maxMessageSize exceeded. rhost:%s",
+ rlink->conn->identity, rlink->identity,
qd_connection_name(conn));
+ // increment policy counters
+ qd_policy_count_max_size_event(pn_link, conn);
+ // reject delivery that went oversize
+ pn_delivery_update(pnd, PN_REJECTED);
+ // Initiate link close with error.
+ pn_condition_t * cond = pn_link_condition(pn_link);
+ (void) pn_condition_set_name(cond,
QD_AMQP_COND_MESSAGE_SIZE_EXCEEDED);
+ pn_link_close(pn_link);
+ // Abort outbound deliveries that were receiving this incoming
delivery
+ qdr_node_disconnect_deliveries(router->router_core, link,
delivery, pnd);
Review comment:
If the message has not yet been forwarded to the core, then delivery here
will be null. qdr_node_disconnect_deliveries will crash in that case IIUC.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]