Commit d57c61fc authored by Simon Morlat's avatar Simon Morlat
Browse files

fix inheritence problem

parent b4be5fe2
......@@ -20,7 +20,13 @@
#include "belle-sip/mainloop.h"
#include "stream_channel.h"
static void set_tcp_nodelay(belle_sip_socket_t sock){
int tmp=1;
int err=setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,(char*)&tmp,sizeof(tmp));
if (err == -1){
belle_sip_warning ("Fail to set TCP_NODELAY: %s.", belle_sip_get_socket_error_string());
}
}
/*************TCP********/
......@@ -181,6 +187,7 @@ int finalize_stream_connection(belle_sip_stream_channel_t *obj, struct sockaddr
#endif
if (obj->base.stack->dscp)
belle_sip_socket_set_dscp(sock,obj->base.lp->ai_family,obj->base.stack->dscp);
set_tcp_nodelay(sock);
return 0;
}else{
belle_sip_error("Connection failed for fd [%i]: cause [%s]",sock,belle_sip_get_socket_error_string_from_code(errnum));
......@@ -232,6 +239,16 @@ belle_sip_channel_t * belle_sip_stream_channel_new_child(belle_sip_stack_t *stac
struct sockaddr_storage localaddr;
socklen_t local_len=sizeof(localaddr);
belle_sip_stream_channel_t *obj;
int err;
int optval=1;
err = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(char*)&optval, sizeof (optval));
if (err == -1){
belle_sip_warning ("Fail to set SIP/TCP address reusable: %s.", belle_sip_get_socket_error_string());
}
set_tcp_nodelay(sock);
if (getsockname(sock,(struct sockaddr*)&localaddr,&local_len)==-1){
belle_sip_error("getsockname() failed: %s",belle_sip_get_socket_error_string());
......
......@@ -86,7 +86,7 @@ static belle_sip_socket_t create_server_socket(const char *addr, int port, int *
err = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(char*)&optval, sizeof (optval));
if (err == -1){
belle_sip_warning ("Fail to set SIP/UDP address reusable: %s.", belle_sip_get_socket_error_string());
belle_sip_warning ("Fail to set SIP/TCP address reusable: %s.", belle_sip_get_socket_error_string());
}
err=bind(sock,res->ai_addr,res->ai_addrlen);
......@@ -97,15 +97,12 @@ static belle_sip_socket_t create_server_socket(const char *addr, int port, int *
return -1;
}
freeaddrinfo(res);
err = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(char*)&optval, sizeof (optval));
if (err == -1){
belle_sip_warning ("Fail to set SIP/UDP address reusable: %s.", belle_sip_get_socket_error_string());
}
err=listen(sock,64);
if (err==-1){
belle_sip_error("TCP listen() failed for %s port %i: %s",addr,port,belle_sip_get_socket_error_string());
close_socket(sock);
return -1;
}
return sock;
}
......
......@@ -38,7 +38,7 @@ BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(belle_sip_tls_listening_point_t);
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR(belle_sip_tls_listening_point_t)={
{
{
BELLE_SIP_VPTR_INIT(belle_sip_tls_listening_point_t, belle_sip_listening_point_t,TRUE),
BELLE_SIP_VPTR_INIT(belle_sip_tls_listening_point_t, belle_sip_stream_listening_point_t,TRUE),
(belle_sip_object_destroy_t)belle_sip_tls_listening_point_uninit,
NULL,
NULL
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment