Skip to content

Instantly share code, notes, and snippets.

@nathanpc
Last active December 11, 2015 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanpc/4514732 to your computer and use it in GitHub Desktop.
Save nathanpc/4514732 to your computer and use it in GitHub Desktop.
Fix for the QUIT bug in leafIRC
void *IRC_Client::handle_recv(void) {
// recv some data.
int numbytes;
char buffer[MAXDATASIZE];
while (true) {
numbytes = recv(socket_descriptor, buffer, MAXDATASIZE - 1, 0);
buffer[numbytes] = '\0';
if (numbytes == 0) {
cout << "Connection terminated" << endl;
system("stty cooked");
exit(0);
}
message_handler(buffer);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment