Skip to content

Commit 536bfcc

Browse files
committed
deadlock fix.
shutdown both read and write of the socket to prevent the reader blocks on read(2) but letting him able to read pending packets. foudn when `disconnect` where called and no more packets are in the socket queue, the reader thread is kept in WAIT state blocking `stop_reader` function on `pthread_join`.
1 parent 5d58371 commit 536bfcc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cSploitClient/connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void disconnect_unix(JNIEnv *env, jclass clazz _U_) {
153153
stop_notifier();
154154

155155
pthread_mutex_lock(&write_lock);
156-
shutdown(sockfd, SHUT_WR);
156+
shutdown(sockfd, SHUT_RDWR);
157157
pthread_mutex_unlock(&write_lock);
158158

159159
stop_reader();

0 commit comments

Comments
 (0)