|
14 | 14 | #include<unistd.h>
|
15 | 15 | #include<string.h>
|
16 | 16 | #include<errno.h>
|
17 |
| -#include<assert.h> |
18 | 17 |
|
19 | 18 | #include"sockhub.h"
|
20 | 19 |
|
@@ -155,12 +154,18 @@ static void reconnect(Shub* shub)
|
155 | 154 | staticvoidnotify_disconnect(Shub*shub,intchan)
|
156 | 155 | {
|
157 | 156 | ShubMessageHdr*hdr;
|
158 |
| -assert(shub->in_buffer_used+sizeof(ShubMessageHdr)<shub->params->buffer_size); |
159 | 157 | hdr= (ShubMessageHdr*)&shub->in_buffer[shub->in_buffer_used];
|
160 | 158 | hdr->size=0;
|
161 | 159 | hdr->chan=chan;
|
162 | 160 | hdr->code=MSG_DISCONNECT;
|
163 | 161 | shub->in_buffer_used+=sizeof(ShubMessageHdr);
|
| 162 | +if (shub->in_buffer_used+sizeof(ShubMessageHdr)>shub->params->buffer_size) { |
| 163 | +while (!write_socket(shub->output,shub->in_buffer,shub->in_buffer_used)) { |
| 164 | +shub->params->error_handler("Failed to write to inet socket",SHUB_RECOVERABLE_ERROR); |
| 165 | +reconnect(shub); |
| 166 | + } |
| 167 | +shub->in_buffer_used=0; |
| 168 | + } |
164 | 169 | }
|
165 | 170 |
|
166 | 171 | staticvoidrecovery(Shub*shub)
|
|