Skip to content

Prevent concurrent process calls to the RequestFifo #239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/chargepoint/requestfifo/RequestFifoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ void RequestFifoManager::requestQueued()
/** @brief Process a FIFO request */
void RequestFifoManager::processFifoRequest()
{
std::lock_guard lock(m_process_mutex);

// Check the connection state
if (m_msg_sender.isConnected())
{
Expand Down
5 changes: 5 additions & 0 deletions src/chargepoint/requestfifo/RequestFifoManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ along with OpenOCPP. If not, see <http://www.gnu.org/licenses/>.
#ifndef OPENOCPP_REQUESTFIFOMANAGER_H
#define OPENOCPP_REQUESTFIFOMANAGER_H

#include <mutex>

#include "IRequestFifo.h"
#include "Timer.h"

Expand Down Expand Up @@ -99,6 +101,9 @@ class RequestFifoManager : public ocpp::messages::IRequestFifo::IListener
/** @brief Retry count for the current request */
unsigned int m_request_retry_count;

/** @brief Mutex protectiing against concurrent processFifoRequest calls */
std::mutex m_process_mutex;

/** @brief Process a FIFO request */
void processFifoRequest();
};
Expand Down
Loading