pike.git/
lib/
modules/
Sql.pmod/
pgsql_util.pmod
Branch:
Tag:
Non-build tags
All tags
No tags
2020-02-19
2020-02-19 09:53:26 by Stephen R. van den Berg <srb@cuci.nl>
c3de6fbb7d0fc577e49bfcefbf00d33c0ba875b0 (
20
lines) (+
11
/-
9
)
[
Show
|
Annotate
]
Branch:
master
pgsql: Eliminate output_to() usage.
475:
|SSL.File #endif socket;
-
private int towrite;
+
final multiset(Result) runningportals = (<>); final MUTEX nostash;
496:
final int queueinidx = -1; #endif
+
private inline void flushtosocket() {
#if PG_DEBUGHISTORY > 0
-
final int(-1..) output_to(Stdio.Stream stm, void|int(0..) nbytes) {
+
Stdio.Buffer tb = Stdio.Buffer(this);
-
int ret =
o::output_to
(
stm,
nbytes
);
+
#endif
+
consume(socket->write(this));
+
#if PG_DEBUGHISTORY > 0
+
int ret =
sizeof
(
tb)
- sizeof(this
);
if (ret) { i->history += ({">>" + tb->read(ret)}); i->history = i->history[<PG_DEBUGHISTORY - 1 ..]; }
-
return ret;
-
}
+
#endif
-
+
}
private inline void queueup(Result portal) { qportals->write(portal); portal->_synctransact = synctransact;
546:
private int write_cb() { Thread.MutexKey lock = shortmux->lock(); if (this) { // Guard against async destructs
-
towrite -= output_to
(
socket, towrite
);
+
flushtosocket
();
lock = 0; if (!i->fillread && !sizeof(this)) close();
614:
case SENDOUT:; } Thread.MutexKey lock = shortmux->trylock();
-
if (lock &&
(towrite =
sizeof(this))
)
{
+
if (lock && sizeof(this)) {
PD("%d>Sendcmd %O\n",
-
socket->query_fd(), (
(
string)this)
[..towrite-1])
;
-
towrite -= output_to
(
socket, towrite
);
+
socket->query_fd(), (string)this);
+
flushtosocket
();
} } while (0); started = 0;