Skip to content

Commit

Permalink
Return Bad_SessionClosed for remaining PublishRequests
Browse files Browse the repository at this point in the history
When the Session is closed and the delete subscriptions flag is set de-queue
any remaining PublishRequests and return a ServiceFault with Bad_SessionClosed.

fixes #846
  • Loading branch information
kevinherron committed Jun 4, 2021
1 parent db7bdee commit 6042060
Showing 1 changed file with 10 additions and 1 deletion.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 the Eclipse Milo Authors
* Copyright (c) 2021 the Eclipse Milo Authors
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -1222,6 +1222,15 @@ public void sessionClosed(boolean deleteSubscriptions) {

iterator.remove();
}

if (deleteSubscriptions) {
while (publishQueue.isNotEmpty()) {
ServiceRequest publishService = publishQueue.poll();
if (publishService != null) {
publishService.setServiceFault(StatusCodes.Bad_SessionClosed);
}
}
}
}

/**
Expand Down

0 comments on commit 6042060

Please sign in to comment.