summaryrefslogtreecommitdiff
path: root/src/libfast/dispatcher.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-01-02 14:18:20 +0100
committerYves-Alexis Perez <corsac@debian.org>2013-01-02 14:18:20 +0100
commitc1343b3278cdf99533b7902744d15969f9d6fdc1 (patch)
treed5ed3dc5677a59260ec41cd39bb284d3e94c91b3 /src/libfast/dispatcher.c
parentb34738ed08c2227300d554b139e2495ca5da97d6 (diff)
downloadvyos-strongswan-c1343b3278cdf99533b7902744d15969f9d6fdc1.tar.gz
vyos-strongswan-c1343b3278cdf99533b7902744d15969f9d6fdc1.zip
Imported Upstream version 5.0.1
Diffstat (limited to 'src/libfast/dispatcher.c')
-rw-r--r--src/libfast/dispatcher.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libfast/dispatcher.c b/src/libfast/dispatcher.c
index e5fca7074..63c872e35 100644
--- a/src/libfast/dispatcher.c
+++ b/src/libfast/dispatcher.c
@@ -179,10 +179,16 @@ static session_entry_t *session_entry_create(private_dispatcher_t *this,
char *host)
{
session_entry_t *entry;
+ session_t *session;
+ session = load_session(this);
+ if (!session)
+ {
+ return NULL;
+ }
INIT(entry,
.cond = condvar_create(CONDVAR_TYPE_DEFAULT),
- .session = load_session(this),
+ .session = session,
.host = strdup(host),
.used = time_monotonic(NULL),
);
@@ -324,6 +330,12 @@ static void dispatch(private_dispatcher_t *this)
else
{ /* create a new session if not found */
found = session_entry_create(this, request->get_host(request));
+ if (!found)
+ {
+ request->destroy(request);
+ this->mutex->unlock(this->mutex);
+ continue;
+ }
sid = found->session->get_sid(found->session);
this->sessions->put(this->sessions, sid, found);
}