MCPcopy Create free account
hub / github.com/apache/cloudberry / pqsecure_raw_read

Function pqsecure_raw_read

src/interfaces/libpq/fe-secure.c:238–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238ssize_t
239pqsecure_raw_read(PGconn *conn, void *ptr, size_t len)
240{
241 ssize_t n;
242 int result_errno = 0;
243 char sebuf[PG_STRERROR_R_BUFLEN];
244
245 n = recv(conn->sock, ptr, len, 0);
246
247 if (n < 0)
248 {
249 result_errno = SOCK_ERRNO;
250
251 /* Set error message if appropriate */
252 switch (result_errno)
253 {
254#ifdef EAGAIN
255 case EAGAIN:
256#endif
257#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
258 case EWOULDBLOCK:
259#endif
260 case EINTR:
261 /* no error message, caller is expected to retry */
262 break;
263
264 case EPIPE:
265 case ECONNRESET:
266 appendPQExpBufferStr(&conn->errorMessage,
267 libpq_gettext("server closed the connection unexpectedly\n"
268 "\tThis probably means the server terminated abnormally\n"
269 "\tbefore or while processing the request.\n"));
270 break;
271
272 default:
273 appendPQExpBuffer(&conn->errorMessage,
274 libpq_gettext("could not receive data from server: %s\n"),
275 SOCK_STRERROR(result_errno,
276 sebuf, sizeof(sebuf)));
277 break;
278 }
279 }
280
281 /* ensure we return the intended errno to caller */
282 SOCK_ERRNO_SET(result_errno);
283
284 return n;
285}
286
287/*
288 * Write data to a secure connection.

Callers 4

my_sock_readFunction · 0.85
pg_GSS_readFunction · 0.85
gss_readFunction · 0.85
pqsecure_readFunction · 0.85

Calls 3

appendPQExpBufferStrFunction · 0.85
libpq_gettextFunction · 0.85
appendPQExpBufferFunction · 0.85

Tested by

no test coverage detected