Skip to content

Commit

Permalink
Closes #3342: Enforce sending the 'initial handshake packet' as soon …
Browse files Browse the repository at this point in the history
…as it's generated
  • Loading branch information
JavierJF committed Apr 2, 2021
1 parent 618a77d commit 83acc66
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/MySQL_Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5245,6 +5245,12 @@ void MySQL_Thread::listener_handle_new_connection(MySQL_Data_Stream *myds, unsig
ioctl_FIONBIO(sess->client_myds->fd, 1);
mypolls.add(POLLIN|POLLOUT, sess->client_myds->fd, sess->client_myds, curtime);
proxy_debug(PROXY_DEBUG_NET,1,"Session=%p -- Adding client FD %d\n", sess, sess->client_myds->fd);

// we now enforce sending the 'initial handshake packet' as soon as it's generated. This
// is done to prevent situations in which a client sends a packet *before* receiving
// this 'initial handshake', leading to invalid state in dataflow, since it will be
// data in both ends of the datastream. For more details see #3342.
sess->writeout();
} else {
free(addr);
// if we arrive here, accept() failed
Expand Down

0 comments on commit 83acc66

Please sign in to comment.