FS-5642 FS-5556 --resolve I have not tested this yet for the connect but I fixed the seg for sure which was an outstanding issue in 5556 reopen 5642 if connect still doesnt work

This commit is contained in:
Anthony Minessale 2013-07-26 11:27:45 -05:00
parent a4bc98a775
commit bc851de200
4 changed files with 28 additions and 10 deletions

View File

@ -1 +1 @@
Thu Jul 11 17:38:06 CDT 2013 Fri Jul 26 11:26:00 CDT 2013

View File

@ -885,12 +885,16 @@ tport_t *tport_alloc_secondary(tport_primary_t *pri,
self->tp_stime = self->tp_ktime = self->tp_rtime = su_now(); self->tp_stime = self->tp_ktime = self->tp_rtime = su_now();
if (pri->pri_vtable->vtp_init_secondary && if (pri->pri_vtable->vtp_init_secondary &&
pri->pri_vtable->vtp_init_secondary(self, socket, accepted,
return_reason) < 0) { pri->pri_vtable->vtp_init_secondary(self, socket, accepted, return_reason) < 0) {
if (pri->pri_vtable->vtp_deinit_secondary)
pri->pri_vtable->vtp_deinit_secondary(self); if (pri->pri_vtable->vtp_deinit_secondary) {
su_home_zap(self->tp_home); pri->pri_vtable->vtp_deinit_secondary(self);
return NULL; }
su_timer_destroy(self->tp_timer);
su_home_zap(self->tp_home);
return NULL;
} }
/* Set IP TOS if it is set in primary */ /* Set IP TOS if it is set in primary */

View File

@ -456,13 +456,17 @@ int tport_ws_init_secondary(tport_t *self, int socket, int accepted,
if ( wspri->ws_secure ) wstp->ws_secure = 1; if ( wspri->ws_secure ) wstp->ws_secure = 1;
memset(&wstp->ws, 0, sizeof(wstp->ws)); memset(&wstp->ws, 0, sizeof(wstp->ws));
if (ws_init(&wstp->ws, socket, wstp->ws_secure ? wspri->ssl_ctx : NULL, 0) < 0) { if (ws_init(&wstp->ws, socket, wstp->ws_secure ? wspri->ssl_ctx : NULL, 0) < 0) {
ws_destroy(&wstp->ws);
su_close(socket);
wstp->ws_initialized = -1;
return *return_reason = "WS_INIT", -1; return *return_reason = "WS_INIT", -1;
} }
wstp->ws_initialized = 1; wstp->ws_initialized = 1;
self->tp_pre_framed = 1; self->tp_pre_framed = 1;
return 0; return 0;

View File

@ -242,6 +242,10 @@ int ws_handshake(wsh_t *wsh)
} }
} }
if (bytes > sizeof(wsh->buffer)) {
goto err;
}
*(wsh->buffer+bytes) = '\0'; *(wsh->buffer+bytes) = '\0';
if (strncasecmp(wsh->buffer, "GET ", 4)) { if (strncasecmp(wsh->buffer, "GET ", 4)) {
@ -325,7 +329,8 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes)
#else #else
if (x++) Sleep(10); if (x++) Sleep(10);
#endif #endif
} while (r == -1 && (errno == EAGAIN || errno == EINTR) && x < 100); } while (r == -1 && (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK ||
errno == 35 || errno == 730035 || errno == 2 || errno == 60) && x < 100);
if (x >= 100) { if (x >= 100) {
r = -1; r = -1;
@ -462,7 +467,12 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock)
} }
while (!wsh->down && !wsh->handshake) { while (!wsh->down && !wsh->handshake) {
ws_handshake(wsh); int r = ws_handshake(wsh);
if (r < 0) {
wsh->down = 1;
return -1;
}
} }
if (wsh->down) { if (wsh->down) {