Browse Source

now it works mostly as before...the only difference is that you really have to be logged in to see the rand value

release0.1.5
Georg Hopp 12 years ago
parent
commit
252cdbb0dc
  1. 17
      src/application/adapter/http/update.c
  2. 3
      src/application/session_stop.c

17
src/application/adapter/http/update.c

@ -4,7 +4,7 @@
* \author Georg Hopp * \author Georg Hopp
* *
* \copyright * \copyright
* Copyright © 2012 Georg Hopp
* Copyright © 2013 Georg Hopp
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,6 +22,7 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#include <time.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h> #include <sys/types.h>
@ -121,8 +122,18 @@ void
applicationAdapterHttpUpdate(void * _this, void * subject) applicationAdapterHttpUpdate(void * _this, void * subject)
{ {
ApplicationAdapterHttp this = _this; ApplicationAdapterHttp this = _this;
HttpWorker worker = (HttpWorker)subject;
unsigned long sid = getSessionId(worker->current_request->cookies);
HttpWorker worker = (HttpWorker)subject;
unsigned long sid = getSessionId(worker->current_request->cookies);
Session session = applicationSessionGet(this->application, sid);
if (NULL != session) {
if (time(NULL) < session->livetime) {
session->livetime = time(NULL) + SESSION_LIVETIME;
} else {
applicationSessionStop(this->application, sid);
}
}
if (0 == strcmp("POST", worker->current_request->method)) { if (0 == strcmp("POST", worker->current_request->method)) {
if (0 == strcmp("/login/", worker->current_request->path)) { if (0 == strcmp("/login/", worker->current_request->path)) {

3
src/application/session_stop.c

@ -35,7 +35,8 @@
void void
applicationSessionStop(Application this, unsigned long sid) applicationSessionStop(Application this, unsigned long sid)
{ {
hashDeleteByVal(this->active_sessions, sid);
Session session = hashDeleteByVal(this->active_sessions, sid);
delete(session);
} }
// vim: set ts=4 sw=4: // vim: set ts=4 sw=4:
Loading…
Cancel
Save