Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
1745dd22
Commit
1745dd22
authored
May 14, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #54 from slene/master
fix session file write bug
parents
98b245c7
6d3486e2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
sess_file.go
session/sess_file.go
+3
-4
No files found.
session/sess_file.go
View file @
1745dd22
...
...
@@ -32,7 +32,6 @@ func (fs *FileSessionStore) Set(key, value interface{}) error {
func
(
fs
*
FileSessionStore
)
Get
(
key
interface
{})
interface
{}
{
fs
.
lock
.
RLock
()
defer
fs
.
lock
.
RUnlock
()
fs
.
updatecontent
()
if
v
,
ok
:=
fs
.
values
[
key
];
ok
{
return
v
}
else
{
...
...
@@ -58,13 +57,13 @@ func (fs *FileSessionStore) SessionRelease() {
}
func
(
fs
*
FileSessionStore
)
updatecontent
()
{
if
len
(
fs
.
values
)
>
0
{
b
,
err
:=
encodeGob
(
fs
.
values
)
if
err
!=
nil
{
return
}
fs
.
f
.
Truncate
(
0
)
fs
.
f
.
Seek
(
0
,
0
)
fs
.
f
.
Write
(
b
)
}
}
type
FileProvider
struct
{
...
...
@@ -107,7 +106,7 @@ func (fp *FileProvider) SessionRead(sid string) (SessionStore, error) {
}
}
f
.
Close
()
f
,
err
=
os
.
Create
(
path
.
Join
(
fp
.
savePath
,
string
(
sid
[
0
]),
string
(
sid
[
1
]),
sid
)
)
f
,
err
=
os
.
OpenFile
(
path
.
Join
(
fp
.
savePath
,
string
(
sid
[
0
]),
string
(
sid
[
1
]),
sid
),
os
.
O_WRONLY
|
os
.
O_CREATE
,
0777
)
ss
:=
&
FileSessionStore
{
f
:
f
,
sid
:
sid
,
values
:
kv
}
return
ss
,
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment