Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
6afa2ae4
Commit
6afa2ae4
authored
24 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Clean up broken test for whether to wait for input in SSL case.
Per discussion with Magnus Hagander.
parent
87968e30
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/postmaster/postmaster.c
+34
-27
34 additions, 27 deletions
src/backend/postmaster/postmaster.c
with
34 additions
and
27 deletions
src/backend/postmaster/postmaster.c
+
34
−
27
View file @
6afa2ae4
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.17
4
2000/10/2
4
2
1:33:52
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.17
5
2000/10/2
5
2
2:27:25
tgl Exp $
*
*
* NOTES
* NOTES
*
*
...
@@ -262,7 +262,7 @@ static void InitSSL(void);
...
@@ -262,7 +262,7 @@ static void InitSSL(void);
#endif
#endif
#ifdef CYR_RECODE
#ifdef CYR_RECODE
void
GetCharSetByHost
(
char
*
,
int
,
char
*
);
extern
void
GetCharSetByHost
(
char
*
,
int
,
char
*
);
#endif
#endif
...
@@ -803,34 +803,38 @@ ServerLoop(void)
...
@@ -803,34 +803,38 @@ ServerLoop(void)
Port
*
port
;
Port
*
port
;
fd_set
rmask
,
fd_set
rmask
,
wmask
;
wmask
;
struct
timeval
*
timeout
=
(
struct
timeval
*
)
NULL
;
#ifdef USE_SSL
#ifdef USE_SSL
bool
no_select
=
false
;
struct
timeval
timeout_tv
;
#endif
/*
/*
* Wait for something to happen.
* If we are using SSL, there may be input data already read and
* pending in SSL's input buffers. If so, check for additional
* input from other clients, but don't delay before processing.
*/
*/
memcpy
((
char
*
)
&
rmask
,
(
char
*
)
&
readmask
,
sizeof
(
fd_set
));
memcpy
((
char
*
)
&
wmask
,
(
char
*
)
&
writemask
,
sizeof
(
fd_set
));
#ifdef USE_SSL
for
(
curr
=
DLGetHead
(
PortList
);
curr
;
curr
=
DLGetSucc
(
curr
))
for
(
curr
=
DLGetHead
(
PortList
);
curr
;
curr
=
DLGetSucc
(
curr
))
{
{
if
(((
Port
*
)
DLE_VAL
(
curr
))
->
ssl
&&
Port
*
port
=
(
Port
*
)
DLE_VAL
(
curr
);
SSL_pending
(((
Port
*
)
DLE_VAL
(
curr
))
->
ssl
)
>
0
)
if
(
port
->
ssl
&&
SSL_pending
(
port
->
ssl
))
{
{
no_select
=
true
;
timeout_tv
.
tv_sec
=
0
;
timeout_tv
.
tv_usec
=
0
;
timeout
=
&
timeout_tv
;
break
;
break
;
}
}
}
}
if
(
no_select
)
FD_ZERO
(
&
rmask
);
/* So we don't accept() anything below */
#endif
#endif
/*
* Wait for something to happen.
*/
memcpy
((
char
*
)
&
rmask
,
(
char
*
)
&
readmask
,
sizeof
(
fd_set
));
memcpy
((
char
*
)
&
wmask
,
(
char
*
)
&
writemask
,
sizeof
(
fd_set
));
PG_SETMASK
(
&
UnBlockSig
);
PG_SETMASK
(
&
UnBlockSig
);
if
(
select
(
nSockets
,
&
rmask
,
&
wmask
,
(
fd_set
*
)
NULL
,
if
(
select
(
nSockets
,
&
rmask
,
&
wmask
,
(
fd_set
*
)
NULL
,
timeout
)
<
0
)
(
struct
timeval
*
)
NULL
)
<
0
)
{
{
if
(
errno
==
EINTR
||
errno
==
EWOULDBLOCK
)
if
(
errno
==
EINTR
||
errno
==
EWOULDBLOCK
)
continue
;
continue
;
...
@@ -894,8 +898,10 @@ ServerLoop(void)
...
@@ -894,8 +898,10 @@ ServerLoop(void)
(
void
*
)
port
);
(
void
*
)
port
);
}
}
/* Build up new masks for select(). */
/*
* Scan active ports, processing any available input. While we
* are at it, build up new masks for next select().
*/
nSockets
=
initMasks
(
&
readmask
,
&
writemask
);
nSockets
=
initMasks
(
&
readmask
,
&
writemask
);
curr
=
DLGetHead
(
PortList
);
curr
=
DLGetHead
(
PortList
);
...
@@ -946,7 +952,7 @@ ServerLoop(void)
...
@@ -946,7 +952,7 @@ ServerLoop(void)
/*
/*
* Can't start backend if max backend count is exceeded.
* Can't start backend if max backend count is exceeded.
*
*
* The same when
shutdowning data bas
e.
* The same when
data base is in startup/shutdown mod
e.
*/
*/
if
(
Shutdown
>
NoShutdown
)
if
(
Shutdown
>
NoShutdown
)
PacketSendError
(
&
port
->
pktInfo
,
PacketSendError
(
&
port
->
pktInfo
,
...
@@ -966,8 +972,8 @@ ServerLoop(void)
...
@@ -966,8 +972,8 @@ ServerLoop(void)
/*
/*
* If the backend start fails then keep the connection
* If the backend start fails then keep the connection
* open to report it. Otherwise, pretend there is an
* open to report it. Otherwise, pretend there is an
* error to close
the connection which will now be
* error to close
our descriptor for the connection,
* managed by the backend.
*
which will now be
managed by the backend.
*/
*/
if
(
BackendStartup
(
port
)
!=
STATUS_OK
)
if
(
BackendStartup
(
port
)
!=
STATUS_OK
)
PacketSendError
(
&
port
->
pktInfo
,
PacketSendError
(
&
port
->
pktInfo
,
...
@@ -1067,22 +1073,23 @@ readStartupPacket(void *arg, PacketLen len, void *pkt)
...
@@ -1067,22 +1073,23 @@ readStartupPacket(void *arg, PacketLen len, void *pkt)
char
SSLok
;
char
SSLok
;
#ifdef USE_SSL
#ifdef USE_SSL
if
(
!
EnableSSL
||
port
->
laddr
.
sa
.
sa_family
!=
AF_INET
)
/* No SSL when disabled or on Unix sockets */
/* No SSL when disabled or on Unix sockets */
if
(
!
EnableSSL
||
port
->
laddr
.
sa
.
sa_family
!=
AF_INET
)
SSLok
=
'N'
;
SSLok
=
'N'
;
else
else
SSLok
=
'S'
;
/* Support for SSL */
SSLok
=
'S'
;
/* Support for SSL */
#else
#else
SSLok
=
'N'
;
/* No support for SSL */
SSLok
=
'N'
;
/* No support for SSL */
#endif
#endif
if
(
send
(
port
->
sock
,
&
SSLok
,
1
,
0
)
!=
1
)
if
(
send
(
port
->
sock
,
&
SSLok
,
1
,
0
)
!=
1
)
{
{
perror
(
"Failed to send SSL negotiation response"
);
perror
(
"Failed to send SSL negotiation response"
);
return
STATUS_ERROR
;
/* Close connection */
return
STATUS_ERROR
;
/* Close connection */
}
}
#ifdef USE_SSL
#ifdef USE_SSL
if
(
SSLok
==
'S'
)
{
if
(
SSLok
==
'S'
)
{
if
(
!
(
port
->
ssl
=
SSL_new
(
SSL_context
))
||
if
(
!
(
port
->
ssl
=
SSL_new
(
SSL_context
))
||
!
SSL_set_fd
(
port
->
ssl
,
port
->
sock
)
||
!
SSL_set_fd
(
port
->
ssl
,
port
->
sock
)
||
SSL_accept
(
port
->
ssl
)
<=
0
)
SSL_accept
(
port
->
ssl
)
<=
0
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment