Permalink
Browse files

Fix irc_rx() infinite recv() loop

  • Loading branch information...
1 parent 8953945 commit 9c521e20ca7d09ea4043fffd4122a33032cb7be2 ec429 committed Jan 27, 2012
Showing with 5 additions and 6 deletions.
  1. +3 −2 irc.c
  2. +1 −1 irc.h
  3. +0 −2 plans
  4. +1 −1 quirc.c
View
5 irc.c
@@ -245,7 +245,7 @@ int irc_tx(int fd, char * packet)
return(l); // Return the number of bytes sent
}
-int irc_rx(int fd, char ** data)
+int irc_rx(int fd, char ** data, fd_set *master)
{
sigpipe=0;
char buf[512];
@@ -264,7 +264,7 @@ int irc_rx(int fd, char ** data)
}
l++;
}
- else if(bytes<0)
+ else // bytes<=0
{
if(errno==EINTR)
continue;
@@ -279,6 +279,7 @@ int irc_rx(int fd, char ** data)
bufs[b].handle=0; // de-bind fd
}
}
+ FD_CLR(fd, master);
cr=true; // just crash out with a partial message
buf[l]=0;
}
View
2 irc.h
@@ -74,7 +74,7 @@ int irc_connect(char *server, const char *portno, fd_set *master, int *fdmax); /
int irc_conn_rest(int b, char *nick, char *username, char *passwd, char *fullname); // call this when the non-blocking connect() has finished
int autoconnect(fd_set *master, int *fdmax, servlist *serv);
int irc_tx(int fd, char * packet);
-int irc_rx(int fd, char ** data);
+int irc_rx(int fd, char ** data, fd_set *master);
message irc_breakdown(char *packet);
void message_free(message pkt);
View
2 plans
@@ -10,8 +10,6 @@ Handle CTCP correctly, on both receive (rx_privmsg()) and send (talk()).
Fix possible issue with CTCP. Funny stuff (including random characters) happened when eg spike1 sent a CTCP PONG to the channel.
-Fix issue with an infinite loop in irc_rx of bytes==0 from recv(). Don't fully understand what causes it.
-
Make hidden lines (quiet mode, conference mode, etc.) be stored in scrollback. Filter on render; that way changes are retroactive.
Optionally fold runs of the same type of message. Eg.: =foo=bar=baz= have joined #whatever.
View
@@ -372,7 +372,7 @@ int main(int argc, char *argv[])
{
char *packet;
int e;
- if((e=irc_rx(fd, &packet))!=0)
+ if((e=irc_rx(fd, &packet, &master))!=0)
{
char emsg[64];
sprintf(emsg, "irc_rx(%d, &%p): %d", fd, packet, e);

0 comments on commit 9c521e2

Please sign in to comment.