Created
March 29, 2022 10:14
-
-
Save no-defun-allowed/abeea4a4b5a5d3f547bef89510e419ba to your computer and use it in GitHub Desktop.
fix libbass.so not knowing how to use SSL in Garry's Mod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int peek_failures = 0; | |
int SSL_peek(SSL *s, void *buf, int num) | |
{ | |
if (s->handshake_func == 0) { | |
SSLerr(SSL_F_SSL_PEEK, SSL_R_UNINITIALIZED); | |
return -1; | |
} | |
if (s->shutdown & SSL_RECEIVED_SHUTDOWN) { | |
return (0); | |
} | |
int ret = (s->method->ssl_peek(s, buf, num)); | |
if (ret > 0 && ret < num) { | |
if (__atomic_load_n(&peek_failures, __ATOMIC_SEQ_CST) > 100) | |
return 0; /* fix libbass.so being shit */ | |
else | |
/* let it handle EOT normally, but log */ | |
__atomic_fetch_add(&peek_failures, 1, __ATOMIC_SEQ_CST); | |
} else { | |
/* checks out */ | |
__atomic_store_n(&peek_failures, 0, __ATOMIC_SEQ_CST); | |
} | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment