*** fe-misc.c Sat May 4 00:11:02 2002 --- fe-misc.c.jack Wed May 1 23:17:08 2002 *************** *** 348,353 **** --- 348,354 ---- /* * pqReadReady: is select() saying the file is ready to read? + * JAB: -or- if SSL is enabled and used, is it buffering bytes? * Returns -1 on failure, 0 if not ready, 1 if ready. */ int *************** *** 359,364 **** --- 360,374 ---- if (!conn || conn->sock < 0) return -1; + /* JAB: Check for SSL library buffering read bytes */ + #ifdef USE_SSL + if (conn->ssl && SSL_pending(conn->ssl) > 0) + { + /* short-circuit the select */ + return 1; + } + #endif + retry1: FD_ZERO(&input_mask); FD_SET(conn->sock, &input_mask); *************** *** 782,787 **** --- 792,800 ---- /* * pqWait: wait until we can read or write the connection socket * + * JAB: If SSL enabled and used and forRead, buffered bytes short-circuit the + * call to select(). + * * We also stop waiting and return if the kernel flags an exception condition * on the socket. The actual error condition will be detected and reported * when the caller tries to read or write the socket. *************** *** 800,805 **** --- 813,827 ---- return EOF; } + /* JAB: Check for SSL library buffering read bytes */ + #ifdef USE_SSL + if (forRead && conn->ssl && SSL_pending(conn->ssl) > 0) + { + /* short-circuit the select */ + return 0; + } + #endif + if (forRead || forWrite) { retry5: