mutt stable branch with some hacks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

surround conn_{read,write} with mutt_allow_interrupt

allows control+c to nicely interrupt hung socket reads, useful for
laptops where network connections change a lot

+41 -2
+41 -2
mutt_socket.c
··· 65 65 if (socket_preconnect ()) 66 66 return -1; 67 67 68 + mutt_allow_interrupt (1); 68 69 rc = conn->conn_open (conn); 70 + mutt_allow_interrupt (0); 69 71 70 72 dprint (2, (debugfile, "Connected to %s:%d on fd=%d\n", 71 73 NONULL (conn->account.host), conn->account.port, conn->fd)); ··· 79 81 80 82 if (conn->fd < 0) 81 83 dprint (1, (debugfile, "mutt_socket_close: Attempt to close closed connection.\n")); 82 - else 84 + else { 85 + mutt_allow_interrupt (1); 83 86 rc = conn->conn_close (conn); 87 + mutt_allow_interrupt (0); 88 + } 84 89 85 90 conn->fd = -1; 86 91 conn->ssf = 0; ··· 90 95 return rc; 91 96 } 92 97 98 + int mutt_socket_read (CONNECTION* conn, char* buf, size_t len) 99 + { 100 + int rc; 101 + 102 + if (conn->fd < 0) 103 + { 104 + dprint (1, (debugfile, "mutt_socket_read: attempt to read from closed connection\n")); 105 + return -1; 106 + } 107 + 108 + mutt_allow_interrupt (1); 109 + rc = conn->conn_read (conn, buf, len); 110 + mutt_allow_interrupt (0); 111 + 112 + /* EOF */ 113 + if (rc == 0) 114 + { 115 + mutt_error (_("Connection to %s closed"), conn->account.host); 116 + mutt_sleep (2); 117 + } 118 + if (rc <= 0) 119 + mutt_socket_close (conn); 120 + 121 + return rc; 122 + } 123 + 93 124 int mutt_socket_write_d (CONNECTION *conn, const char *buf, int len, int dbg) 94 125 { 95 126 int rc; ··· 108 139 109 140 while (sent < len) 110 141 { 111 - if ((rc = conn->conn_write (conn, buf + sent, len - sent)) < 0) 142 + mutt_allow_interrupt (1); 143 + rc = conn->conn_write (conn, buf + sent, len - sent); 144 + mutt_allow_interrupt (0); 145 + 146 + if (rc < 0) 112 147 { 113 148 dprint (1, (debugfile, 114 149 "mutt_socket_write: error writing (%s), closing socket\n", ··· 150 185 if (conn->bufpos >= conn->available) 151 186 { 152 187 if (conn->fd >= 0) 188 + { 189 + mutt_allow_interrupt (1); 153 190 conn->available = conn->conn_read (conn, conn->inbuf, sizeof (conn->inbuf)); 191 + mutt_allow_interrupt (0); 192 + } 154 193 else 155 194 { 156 195 dprint (1, (debugfile, "mutt_socket_readchar: attempt to read from closed connection.\n"));