Skip to content

Commit 26bb978

Browse files
authored
Merge pull request #4581 from sysown/v2.x-POLLHUP
Check POLLHUP if unable to read anything from network
2 parents 80a3d8b + 95ad467 commit 26bb978

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

deps/mariadb-client-library/x509cache.patch

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ index 916024a8..79564a10 100644
3535

3636
int STDCALL mysql_set_server_option(MYSQL *mysql,
3737
diff --git libmariadb/secure/openssl.c libmariadb/secure/openssl.c
38+
index 916024a8..79564a10 100644
39+
--- libmariadb/secure/openssl.c
40+
+++ libmariadb/secure/openssl.c
3841
@@ -30,6 +30,11 @@
3942
#include <openssl/conf.h>
4043
#include <openssl/md4.h>
@@ -81,9 +84,9 @@ diff --git libmariadb/secure/openssl.c libmariadb/secure/openssl.c
8184
+ close(fd);
8285
+ return 0;
8386
+ }
84-
+ // Compute the SHA-1 hash
8587
+ SHA1(fb, statbuf.st_size, temp);
86-
+ for (int i=0; i < SHA_DIGEST_LENGTH; i++) {
88+
+ int i=0;
89+
+ for (i=0; i < SHA_DIGEST_LENGTH; i++) {
8790
+ sprintf((char*)&(file_sha1[i*2]), "%02x", temp[i]);
8891
+ }
8992
+ free(fb);

lib/mysql_data_stream.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,12 @@ int MySQL_Data_Stream::read_from_net() {
722722
// it seems we end in shut_soft() anyway
723723
}
724724
}
725+
if ( (revents & POLLHUP) ) {
726+
// this is a final check
727+
// Only if the amount of data read is 0 or less, then we check POLLHUP
728+
proxy_debug(PROXY_DEBUG_NET, 5, "Session=%p, Datastream=%p -- shutdown soft. revents=%d , bytes read = %d\n", sess, this, revents, r);
729+
shut_soft();
730+
}
725731
} else {
726732
queue_w(queueIN,r);
727733
bytes_info.bytes_recv+=r;

0 commit comments

Comments
 (0)