Changeset 419:1f087a2bf661 in verona
- Timestamp:
- Jan 23, 2012 3:29:39 PM (17 months ago)
- Branch:
- default
- rebase_source:
- d04508730cd4ba67335d6e7f1eace86b6938aea9
- Location:
- libeXosip2/src
- Files:
-
- 2 edited
-
eXtl_socks.c (modified) (7 diffs)
-
udp.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libeXosip2/src/eXtl_socks.c
r418 r419 452 452 int need_more = sk->udplen - sk->pbuflen; 453 453 454 i = recv(sk->socket, sk->pbuf , need_more, 0);454 i = recv(sk->socket, sk->pbuf+sk->pbuflen, need_more, 0); 455 455 if (i > 0) { 456 456 sk->pbuflen += i; … … 463 463 sk->remote_port); 464 464 sk->udplen = 0; 465 sk->pbuflen = 0; 465 466 466 467 } … … 718 719 } 719 720 720 static int _socks_tl_connect_socket2(char *host, int port, int mode )721 static int _socks_tl_connect_socket2(char *host, int port, int mode, int *tabx) 721 722 { 722 723 int res; … … 737 738 return -1; 738 739 740 739 741 sock = sk->socket; 740 742 741 743 742 744 if (sock > 0) { 743 if (mode & SOCKST_UDPMASK) { 744 sk->pbuf = (char *) osip_malloc(SIP_MESSAGE_MAX_LENGTH); 745 if (!sk->pbuf) { 746 closesocket(sk->socket); 747 memset(sk, 0, sizeof(*sk)); 748 return -1; 749 } 750 751 } 752 745 if (*tabx) 746 *tabx = sk - socks_socket_tab; 753 747 return sock; 754 748 } … … 757 751 } 758 752 753 static int socks_tl_fix_message(osip_message_t *sip, int tlx) 754 { 755 char portstr[16]; 756 757 osip_contact_t *ctct = (osip_contact_t*) osip_list_get(&sip->contacts, 0); 758 osip_via_t *via = (osip_via_t *) osip_list_get(&sip->vias, 0); 759 760 snprintf(portstr,16,"%d", socks_socket_tab[tlx].public_port); 761 762 763 if (ctct && ctct->url) { 764 if (ctct->url->port) 765 osip_free(ctct->url->port); 766 767 ctct->url->port = osip_strdup(portstr); 768 sip->message_property = 2; 769 } 770 771 if (via) { 772 if (via->port) 773 osip_free(via->port); 774 via->port = osip_strdup(portstr); 775 sip->message_property = 2; 776 } 777 778 return 0; 779 780 } 759 781 760 782 static int … … 774 796 } 775 797 798 /* Step 1: find existing socket to send message */ 799 if (out_socket <= 0) { 800 out_socket = _socks_tl_find_socket(host, port); 801 802 /* Step 2: create new socket with host:port */ 803 if (out_socket <= 0) { 804 int tlx; 805 806 out_socket = _socks_tl_connect_socket2(host, port, mode, &tlx); 807 if (out_socket > 0) { 808 809 socks_tl_fix_message(sip, tlx); 810 } 811 } 812 } else { 813 OSIP_TRACE(osip_trace(__FILE__, __LINE__, OSIP_INFO1, NULL, 814 "reusing REQUEST connection (to dest=%s:%i)\n", 815 host, port)); 816 } 817 818 if (out_socket <= 0) { 819 osip_free(message); 820 return -1; 821 } 822 776 823 /* remove preloaded route if there is no tag in the To header 777 824 */ … … 795 842 } 796 843 797 /* Step 1: find existing socket to send message */798 if (out_socket <= 0) {799 out_socket = _socks_tl_find_socket(host, port);800 801 /* Step 2: create new socket with host:port */802 if (out_socket <= 0) {803 out_socket = _socks_tl_connect_socket2(host, port, mode);804 }805 } else {806 OSIP_TRACE(osip_trace(__FILE__, __LINE__, OSIP_INFO1, NULL,807 "reusing REQUEST connection (to dest=%s:%i)\n",808 host, port));809 }810 811 if (out_socket <= 0) {812 osip_free(message);813 return -1;814 }815 844 816 845 i = _socks_tl_is_connected(out_socket); -
libeXosip2/src/udp.c
r386 r419 1592 1592 eXtl_udp.tl_set_fdset(&osip_fdset, &max); 1593 1593 eXtl_tcp.tl_set_fdset(&osip_fdset, &max); 1594 if (eXosip.eXtl) 1595 eXosip.eXtl->tl_set_fdset(&osip_fdset, &max); 1594 1596 #ifdef HAVE_OPENSSL_SSL_H 1595 1597 #if !(OPENSSL_VERSION_NUMBER < 0x00908000L) … … 1635 1637 eXtl_udp.tl_read_message(&osip_fdset); 1636 1638 eXtl_tcp.tl_read_message(&osip_fdset); 1639 if (eXosip.eXtl) 1640 eXosip.eXtl->tl_read_message(&osip_fdset); 1641 1637 1642 #ifdef HAVE_OPENSSL_SSL_H 1638 1643 #if !(OPENSSL_VERSION_NUMBER < 0x00908000L)
Note: See TracChangeset
for help on using the changeset viewer.
