MCPcopy Create free account
hub / github.com/F-Stack/f-stack / connTLSSyncReadLine

Function connTLSSyncReadLine

app/redis-6.2.6/src/tls.c:888–916  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

886}
887
888static ssize_t connTLSSyncReadLine(connection *conn_, char *ptr, ssize_t size, long long timeout) {
889 tls_connection *conn = (tls_connection *) conn_;
890 ssize_t nread = 0;
891
892 setBlockingTimeout(conn, timeout);
893
894 size--;
895 while(size) {
896 char c;
897
898 if (SSL_read(conn->ssl,&c,1) <= 0) {
899 nread = -1;
900 goto exit;
901 }
902 if (c == '\n') {
903 *ptr = '\0';
904 if (nread && *(ptr-1) == '\r') *(ptr-1) = '\0';
905 goto exit;
906 } else {
907 *ptr++ = c;
908 *ptr = '\0';
909 nread++;
910 }
911 size--;
912 }
913exit:
914 unsetBlockingTimeout(conn);
915 return nread;
916}
917
918static int connTLSGetType(connection *conn_) {
919 (void) conn_;

Callers

nothing calls this directly

Calls 2

setBlockingTimeoutFunction · 0.85
unsetBlockingTimeoutFunction · 0.85

Tested by

no test coverage detected