]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5642 FS-5556 --resolve I have not tested this yet for the connect but I fixed...
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 26 Jul 2013 16:27:45 +0000 (11:27 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 26 Jul 2013 16:27:45 +0000 (11:27 -0500)
libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/tport/tport.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c
libs/sofia-sip/libsofia-sip-ua/tport/ws.c

index 17253549d179bd5f5c721f1ded9cc16d69e7021c..4dc866b6d6d368a4dbf96eeab7e7e90f27ffd46f 100644 (file)
@@ -1 +1 @@
-Thu Jul 11 17:38:06 CDT 2013
+Fri Jul 26 11:26:00 CDT 2013
index 6cbb4336ce0bd703d0abe720e4e126050af66795..50050e228938dff0856342a3d90d5a8ab58e1025 100644 (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();
 
     if (pri->pri_vtable->vtp_init_secondary &&
-       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);
-      su_home_zap(self->tp_home);
-      return NULL;
+
+               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);
+               }
+               su_timer_destroy(self->tp_timer);
+               su_home_zap(self->tp_home);
+
+               return NULL;
     }
 
     /* Set IP TOS if it is set in primary */
index 22c56ef07fae12df1f9efc4ca488d19872ea7c27..67f78148fb56a84dac07797c9ab9095235b0c565 100644 (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;
 
   memset(&wstp->ws, 0, sizeof(wstp->ws));
-  
+
   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;
   }
 
   wstp->ws_initialized = 1;
   self->tp_pre_framed = 1;
+  
 
 
   return 0;
index 33d984a9d582e73312ddba5df170b363958c2b96..35fb4c0f229ea116fb65d64fa260f412988a47f7 100644 (file)
@@ -242,6 +242,10 @@ int ws_handshake(wsh_t *wsh)
                }
        }
 
+       if (bytes > sizeof(wsh->buffer)) {
+               goto err;
+       }
+
        *(wsh->buffer+bytes) = '\0';
        
        if (strncasecmp(wsh->buffer, "GET ", 4)) {
@@ -325,7 +329,8 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes)
 #else
                if (x++) Sleep(10);
 #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) {
                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) {
-               ws_handshake(wsh);
+               int r = ws_handshake(wsh);
+
+               if (r < 0) {
+                       wsh->down = 1;
+                       return -1;
+               }
        }
 
        if (wsh->down) {