Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ingo Voss
OpenLDAP
Commits
30869197
Commit
30869197
authored
Nov 02, 2005
by
Howard Chu
Browse files
Fix fastpath for internal clients (e.g. syncrepl) too.
parent
44fcfb9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
servers/slapd/connection.c
View file @
30869197
...
...
@@ -106,7 +106,15 @@ connection_state2str( int state )
static
Connection
*
connection_get
(
ber_socket_t
s
);
#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
static
int
connection_input
(
Connection
*
c
,
Operation
**
op
);
typedef
struct
conn_readinfo
{
Operation
*
op
;
ldap_pvt_thread_start_t
*
func
;
void
*
arg
;
int
nullop
;
}
conn_readinfo
;
static
int
connection_input
(
Connection
*
c
,
conn_readinfo
*
cri
);
#else
static
int
connection_input
(
Connection
*
c
);
#endif
...
...
@@ -1405,26 +1413,29 @@ void connection_client_stop(
}
#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
static
int
connection_read
(
ber_socket_t
s
,
Operation
**
op
);
static
int
connection_read
(
ber_socket_t
s
,
conn_readinfo
*
cri
);
static
void
*
connection_read_thread
(
void
*
ctx
,
void
*
argv
)
{
int
rc
;
Operation
*
new_op
[
2
]
=
{
NULL
,
NULL
};
conn_readinfo
cri
=
{
NULL
,
NULL
,
NULL
,
0
};
ber_socket_t
s
=
(
long
)
argv
;
/*
* read incoming LDAP requests. If there is more than one,
* the first one is returned with new_op
*/
if
(
(
rc
=
connection_read
(
s
,
new_op
)
)
<
0
)
{
if
(
(
rc
=
connection_read
(
s
,
&
cri
)
)
<
0
)
{
Debug
(
LDAP_DEBUG_CONNS
,
"connection_read(%d) error
\n
"
,
s
,
0
,
0
);
return
(
void
*
)(
long
)
rc
;
}
/* execute a single queued request in the same thread */
if
(
new_op
[
0
]
&&
!
new_op
[
1
]
)
{
rc
=
(
long
)
connection_operation
(
ctx
,
new_op
[
0
]
);
if
(
cri
.
op
&&
!
cri
.
nullop
)
{
rc
=
(
long
)
connection_operation
(
ctx
,
cri
.
op
);
}
else
if
(
cri
.
func
)
{
rc
=
(
long
)
cri
.
func
(
ctx
,
cri
.
arg
);
}
return
(
void
*
)(
long
)
rc
;
...
...
@@ -1458,7 +1469,7 @@ int connection_read_activate( ber_socket_t s )
#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
static
int
connection_read
(
ber_socket_t
s
,
Operation
**
op
)
connection_read
(
ber_socket_t
s
,
conn_readinfo
*
cri
)
#else
int
connection_read
(
ber_socket_t
s
)
#endif
...
...
@@ -1499,13 +1510,14 @@ int connection_read(ber_socket_t s)
if
(
c
->
c_conn_state
==
SLAP_C_CLIENT
)
{
#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
cri
->
func
=
c
->
c_clientfunc
;
cri
->
arg
=
c
->
c_clientarg
;
/* read should already be cleared */
#else
slapd_clr_read
(
s
,
0
);
#endif
ldap_pvt_thread_pool_submit
(
&
connection_pool
,
c
->
c_clientfunc
,
c
->
c_clientarg
);
#endif
connection_return
(
c
);
ldap_pvt_thread_mutex_unlock
(
MCA_GET_CONN_MUTEX
(
s
)
);
return
0
;
...
...
@@ -1632,7 +1644,7 @@ int connection_read(ber_socket_t s)
do
{
/* How do we do this without getting into a busy loop ? */
#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
rc
=
connection_input
(
c
,
op
);
rc
=
connection_input
(
c
,
cri
);
#else
rc
=
connection_input
(
c
);
#endif
...
...
@@ -1682,7 +1694,7 @@ int connection_read(ber_socket_t s)
static
int
#ifdef SLAP_LIGHTWEIGHT_DISPATCHER
connection_input
(
Connection
*
conn
,
Operation
**
c_op
)
connection_input
(
Connection
*
conn
,
conn_readinfo
*
cri
)
#else
connection_input
(
Connection
*
conn
)
#endif
...
...
@@ -1878,14 +1890,14 @@ connection_input( Connection *conn )
* Subsequent ops will be submitted to the pool by
* calling connection_op_activate()
*/
if
(
c
_op
[
0
]
==
NULL
)
{
if
(
c
ri
->
op
==
NULL
)
{
/* the first incoming request */
connection_op_queue
(
op
);
c
_op
[
0
]
=
op
;
c
ri
->
op
=
op
;
}
else
{
c
_op
[
1
]
=
op
;
c
ri
->
nullop
=
1
;
rc
=
ldap_pvt_thread_pool_submit
(
&
connection_pool
,
connection_operation
,
(
void
*
)
c
_op
[
0
]
);
connection_operation
,
(
void
*
)
c
ri
->
op
);
connection_op_activate
(
op
);
}
#else
...
...
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