Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removing the sending of the QUIT command to the server: The server do…

…es not have an implementation of this.

Causes an issue of the server throwing Connection reset by peer

Explanation:
Client establishes socket
Client sends command (next, update, peek, etc)
Client waits for response
Server sends response (+OK, -ERROR, etc)
Client receives response
Client sends QUIT
Client closes socket
Server receives QUIT 
Server responds -ERROR (valid error handling because QUIT is not a valid command)
  - Socket is closed so server throws ECONNECTRESET (and a SIGPIPE I think)

Server handles a few of these alright, but if the server is being sent commands a lot then the errors get stacked quickly and the eventual effect is a Seg Fault
  • Loading branch information...
commit 9d95fa5f509bac8a5208cbe532a3bc1b231703bf 1 parent f2e27af
@dwayn dwayn authored committed
Showing with 1 addition and 1 deletion.
  1. +1 −1  clients/php/barbershop.c
View
2  clients/php/barbershop.c
@@ -235,7 +235,7 @@ PHPAPI int barbershop_sock_server_open(BarbershopSock *barbershop_sock, int forc
PHPAPI int barbershop_sock_disconnect(BarbershopSock *barbershop_sock TSRMLS_DC) {
int res = 0;
if (barbershop_sock->stream != NULL) {
- barbershop_sock_write(barbershop_sock, "QUIT", sizeof("QUIT") - 1);
+ //barbershop_sock_write(barbershop_sock, "QUIT", sizeof("QUIT") - 1);
barbershop_sock->status = BARBERSHOP_SOCK_STATUS_DISCONNECTED;
php_stream_close(barbershop_sock->stream);
barbershop_sock->stream = NULL;
Please sign in to comment.
Something went wrong with that request. Please try again.