46 |
|
|
47 |
$self->current_store->open( @_ ); |
$self->current_store->open( @_ ); |
48 |
|
|
49 |
|
# so that we don't have to check if it's defined |
50 |
|
$self->debug( 0 ) unless $self->debug; |
51 |
|
|
52 |
return $self; |
return $self; |
53 |
} |
} |
54 |
|
|
66 |
|
|
67 |
confess "unknown store module $module not one of ", dump( $self->possible_stores ) unless $s; |
confess "unknown store module $module not one of ", dump( $self->possible_stores ) unless $s; |
68 |
|
|
69 |
warn "## current store = $s\n" if $self->debug; |
# warn "#### current store = $s\n" if $self->debug > 4; |
70 |
|
|
71 |
return $s; |
return $s; |
72 |
} |
} |
87 |
confess "need $k value" unless $v; |
confess "need $k value" unless $v; |
88 |
confess "need state" unless $state; |
confess "need state" unless $state; |
89 |
|
|
90 |
warn "## update_state( $k => $v, ", dump( $state ), " )\n" if $self->debug; |
warn "#### update_state( $k => $v, ", dump( $state ), " )\n" if $self->debug > 4; |
91 |
|
|
92 |
my $uid; |
my $uid; |
93 |
|
|
120 |
confess "need ID or uid" unless $k =~ m/^(ID|uid)$/; |
confess "need ID or uid" unless $k =~ m/^(ID|uid)$/; |
121 |
confess "need $k value" unless $v; |
confess "need $k value" unless $v; |
122 |
|
|
123 |
warn "## get_state( $k => $v )\n" if $self->debug; |
warn "#### get_state( $k => $v )\n" if $self->debug > 4; |
124 |
|
|
125 |
my $uid; |
my $uid; |
126 |
|
|
169 |
|
|
170 |
confess "need ID" unless $ID; |
confess "need ID" unless $ID; |
171 |
|
|
172 |
warn "ID_to_uid",dump( $ID, $state ),$/ if $self->debug; |
warn "#### ID_to_uid",dump( $ID, $state ),$/ if $self->debug > 4; |
173 |
|
|
174 |
$session->{ $ID }->{last_seen} = time(); |
$session->{ $ID }->{last_seen} = time(); |
175 |
|
|
186 |
return $uid; |
return $uid; |
187 |
} else { |
} else { |
188 |
warn "## can't find uid for ID $ID, first seen?\n"; |
warn "## can't find uid for ID $ID, first seen?\n"; |
|
return; |
|
189 |
} |
} |
190 |
|
|
191 |
# TODO: expire sessions longer than 30m |
# TODO: expire sessions longer than 30m |
192 |
|
|
|
warn "current session = ",dump( $session ); |
|
|
|
|
193 |
return; |
return; |
194 |
} |
} |
195 |
|
|