Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
8624d492
Commit
8624d492
authored
Dec 20, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the client IP+port onto the sess structure instead of the
sess workspace.
parent
ee439631
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
47 deletions
+39
-47
cache.h
bin/varnishd/cache/cache.h
+3
-4
cache_acceptor.c
bin/varnishd/cache/cache_acceptor.c
+2
-20
cache_center.c
bin/varnishd/cache/cache_center.c
+19
-0
cache_session.c
bin/varnishd/cache/cache_session.c
+4
-5
cache_ws.c
bin/varnishd/cache/cache_ws.c
+0
-16
common.h
bin/varnishd/common/common.h
+9
-0
r00693.vtc
bin/varnishtest/tests/r00693.vtc
+2
-2
No files found.
bin/varnishd/cache/cache.h
View file @
8624d492
...
...
@@ -600,8 +600,8 @@ struct sess {
struct
listen_sock
*
mylsock
;
/* formatted ascii client address */
char
*
addr
;
char
*
port
;
char
addr
[
ADDR_BUFSIZE
]
;
char
port
[
PORT_BUFSIZE
]
;
char
*
client_identity
;
/* HTTP request */
...
...
@@ -662,7 +662,7 @@ struct sess {
/* Prototypes etc ----------------------------------------------------*/
/* cache_acceptor.c */
void
VCA_Prep
(
struct
sess
*
sp
);
void
VCA_Prep
(
const
struct
sess
*
sp
);
void
VCA_Init
(
void
);
void
VCA_Shutdown
(
void
);
int
VCA_Accept
(
struct
listen_sock
*
ls
,
struct
wrk_accept
*
wa
);
...
...
@@ -997,7 +997,6 @@ void WS_ReleaseP(struct ws *ws, char *ptr);
void
WS_Assert
(
const
struct
ws
*
ws
);
void
WS_Reset
(
struct
ws
*
ws
,
char
*
p
);
char
*
WS_Alloc
(
struct
ws
*
ws
,
unsigned
bytes
);
char
*
WS_Dup
(
struct
ws
*
ws
,
const
char
*
);
char
*
WS_Snapshot
(
struct
ws
*
ws
);
unsigned
WS_Free
(
const
struct
ws
*
ws
);
...
...
bin/varnishd/cache/cache_acceptor.c
View file @
8624d492
...
...
@@ -113,27 +113,9 @@ sock_test(int fd)
*/
void
VCA_Prep
(
struct
sess
*
sp
)
VCA_Prep
(
const
struct
sess
*
sp
)
{
char
addr
[
VTCP_ADDRBUFSIZE
];
char
port
[
VTCP_PORTBUFSIZE
];
VTCP_name
(
&
sp
->
sockaddr
,
sp
->
sockaddrlen
,
addr
,
sizeof
addr
,
port
,
sizeof
port
);
sp
->
addr
=
WS_Dup
(
sp
->
ws
,
addr
);
sp
->
port
=
WS_Dup
(
sp
->
ws
,
port
);
if
(
cache_param
->
log_local_addr
)
{
AZ
(
getsockname
(
sp
->
fd
,
(
void
*
)
&
sp
->
mysockaddr
,
&
sp
->
mysockaddrlen
));
VTCP_name
(
&
sp
->
mysockaddr
,
sp
->
mysockaddrlen
,
addr
,
sizeof
addr
,
port
,
sizeof
port
);
WSP
(
sp
,
SLT_SessionOpen
,
"%s %s %s %s"
,
sp
->
addr
,
sp
->
port
,
addr
,
port
);
}
else
{
WSP
(
sp
,
SLT_SessionOpen
,
"%s %s %s"
,
sp
->
addr
,
sp
->
port
,
sp
->
mylsock
->
name
);
}
sp
->
acct_ses
.
first
=
sp
->
t_open
;
if
(
need_test
)
sock_test
(
sp
->
fd
);
if
(
need_linger
)
...
...
bin/varnishd/cache/cache_center.c
View file @
8624d492
...
...
@@ -64,6 +64,8 @@ DOT acceptor -> first [style=bold,color=green]
#include "cache.h"
#include "common/heritage.h"
#include "hash/hash_slinger.h"
#include "vcl.h"
#include "vcli_priv.h"
...
...
@@ -1005,6 +1007,8 @@ static int
cnt_first
(
struct
sess
*
sp
)
{
struct
worker
*
wrk
;
char
laddr
[
ADDR_BUFSIZE
];
char
lport
[
PORT_BUFSIZE
];
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
wrk
=
sp
->
wrk
;
...
...
@@ -1020,6 +1024,21 @@ cnt_first(struct sess *sp)
assert
(
sp
->
xid
==
0
);
assert
(
sp
->
restarts
==
0
);
AZ
(
sp
->
esi_level
);
VTCP_name
(
&
sp
->
sockaddr
,
sp
->
sockaddrlen
,
sp
->
addr
,
sizeof
sp
->
addr
,
sp
->
port
,
sizeof
sp
->
port
);
if
(
cache_param
->
log_local_addr
)
{
AZ
(
getsockname
(
sp
->
fd
,
(
void
*
)
&
sp
->
mysockaddr
,
&
sp
->
mysockaddrlen
));
VTCP_name
(
&
sp
->
mysockaddr
,
sp
->
mysockaddrlen
,
laddr
,
sizeof
laddr
,
lport
,
sizeof
lport
);
WSP
(
sp
,
SLT_SessionOpen
,
"%s %s %s %s"
,
sp
->
addr
,
sp
->
port
,
laddr
,
lport
);
}
else
{
WSP
(
sp
,
SLT_SessionOpen
,
"%s %s %s"
,
sp
->
addr
,
sp
->
port
,
sp
->
mylsock
->
name
);
}
sp
->
acct_ses
.
first
=
sp
->
t_open
;
VCA_Prep
(
sp
);
/* Record the session watermark */
...
...
bin/varnishd/cache/cache_session.c
View file @
8624d492
...
...
@@ -321,7 +321,6 @@ SES_Delete(struct sess *sp, const char *reason)
{
struct
acct
*
b
;
struct
sessmem
*
sm
;
static
char
noaddr
[]
=
"-"
;
struct
worker
*
wrk
;
struct
sesspool
*
pp
;
...
...
@@ -340,10 +339,10 @@ SES_Delete(struct sess *sp, const char *reason)
assert
(
sp
->
fd
<
0
);
AZ
(
sp
->
vcl
);
if
(
sp
->
addr
==
NULL
)
s
p
->
addr
=
noaddr
;
if
(
sp
->
port
==
NULL
)
s
p
->
port
=
noaddr
;
if
(
*
sp
->
addr
==
'\0'
)
s
trcpy
(
sp
->
addr
,
"-"
)
;
if
(
*
sp
->
port
==
'\0'
)
s
trcpy
(
sp
->
addr
,
"-"
)
;
b
=
&
sp
->
acct_ses
;
assert
(
!
isnan
(
b
->
first
));
...
...
bin/varnishd/cache/cache_ws.c
View file @
8624d492
...
...
@@ -116,22 +116,6 @@ WS_Alloc(struct ws *ws, unsigned bytes)
return
(
r
);
}
char
*
WS_Dup
(
struct
ws
*
ws
,
const
char
*
s
)
{
unsigned
l
;
char
*
p
;
WS_Assert
(
ws
);
l
=
strlen
(
s
)
+
1
;
p
=
WS_Alloc
(
ws
,
l
);
if
(
p
!=
NULL
)
memcpy
(
p
,
s
,
l
);
DSL
(
0x02
,
SLT_Debug
,
0
,
"WS_Dup(%p,
\"
%s
\"
) = %p"
,
ws
,
s
,
p
);
WS_Assert
(
ws
);
return
(
p
);
}
unsigned
WS_Free
(
const
struct
ws
*
ws
)
{
...
...
bin/varnishd/common/common.h
View file @
8624d492
...
...
@@ -60,6 +60,15 @@ struct cli;
*/
#define __state_variable__(xxx)
/*lint -esym(838,xxx) */
/**********************************************************************
* NI_MAXHOST and less so NI_MAXSERV, are ridiculously large for numeric
* representations of TCP/IP socket addresses, so we use our own.
*/
#define ADDR_BUFSIZE 64
#define PORT_BUFSIZE 8
/**********************************************************************/
/* Name of transient storage */
...
...
bin/varnishtest/tests/r00693.vtc
View file @
8624d492
...
...
@@ -51,8 +51,8 @@ varnish v1 -arg "-p sess_workspace=1024" -vcl+backend {
"0123456789abcdef" + "0123456789abcdef" +
"0123456789abcdef" + "0123456789abcdef" +
"0123456789abcdef" + "0123456789abcdef" +
"0123456789abcdef" +
"0123456";
"0123456789abcdef" +
"0123456789abcdef" +
"0123456
789abcde
";
set req.http.baz = "BAZ";
return (pass);
}
...
...
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