Skip to content
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

src: more debug statements #708

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 3 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
14 changes: 10 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ function session(options) {
return function session(req, res, next) {
// self-awareness
if (req.session) {
debug('re-using existing session')
next()
return
}
Expand Down Expand Up @@ -302,13 +303,13 @@ function session(options) {

if (shouldDestroy(req)) {
// destroy session
debug('destroying');
debug('destroying session');
dougwilson marked this conversation as resolved.
Show resolved Hide resolved
store.destroy(req.sessionID, function ondestroy(err) {
if (err) {
defer(next, err);
}

debug('destroyed');
debug('session destroyed');
dougwilson marked this conversation as resolved.
Show resolved Hide resolved
writeend();
});

Expand Down Expand Up @@ -357,6 +358,7 @@ function session(options) {

// generate the session
function generate() {
debug('session generate');
dougwilson marked this conversation as resolved.
Show resolved Hide resolved
store.generate(req);
originalId = req.sessionID;
originalHash = hash(req.session);
Expand Down Expand Up @@ -389,10 +391,14 @@ function session(options) {
})
}

function save() {
function save(cb) {
dougwilson marked this conversation as resolved.
Show resolved Hide resolved
debug('saving %s', this.id);
savedHash = hash(this);
_save.apply(this, arguments);
_save.call(this, function(err) {
dougwilson marked this conversation as resolved.
Show resolved Hide resolved
if(!err)
debug('session saved');
cb(err);
dougwilson marked this conversation as resolved.
Show resolved Hide resolved
});
}

Object.defineProperty(sess, 'reload', {
Expand Down