~ubuntu-branches/ubuntu/vivid/gloox/vivid-proposed

« back to all changes in this revision

Viewing changes to src/connectiontcpserver.cpp

  • Committer: Package Import Robot
  • Author(s): Vincent Cheng
  • Date: 2014-03-16 17:34:43 UTC
  • mfrom: (12.1.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: package-import@ubuntu.com-20140316173443-4s177dovzaz5dm8o
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
  Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net>
 
2
  Copyright (c) 2004-2013 by Jakob Schroeter <js@camaya.net>
3
3
  This file is part of the gloox library. http://camaya.net/gloox
4
4
 
5
5
  This software is distributed under a license. The full license
14
14
 
15
15
#include "gloox.h"
16
16
 
 
17
#include "config.h"
 
18
 
17
19
#include "connectiontcpserver.h"
18
20
#include "connectiontcpclient.h"
19
21
#include "connectionhandler.h"
87
89
    if( m_socket < 0 )
88
90
      return ConnIoError;
89
91
 
 
92
#ifdef HAVE_SETSOCKOPT
 
93
    int buf = 0;
 
94
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
 
95
    int bufbytes = sizeof( int );
 
96
#else
 
97
    socklen_t bufbytes = sizeof( int );
 
98
#endif
 
99
    if( ( getsockopt( m_socket, SOL_SOCKET, SO_RCVBUF, (char*)&buf, &bufbytes ) != -1 ) &&
 
100
        ( m_bufsize > buf ) )
 
101
      setsockopt( m_socket, SOL_SOCKET, SO_RCVBUF, (char*)&m_bufsize, sizeof( m_bufsize ) );
 
102
 
 
103
    if( ( getsockopt( m_socket, SOL_SOCKET, SO_SNDBUF, (char*)&buf, &bufbytes ) != -1 ) &&
 
104
        ( m_bufsize > buf ) )
 
105
      setsockopt( m_socket, SOL_SOCKET, SO_SNDBUF, (char*)&m_bufsize, sizeof( m_bufsize ) );
 
106
#endif
 
107
 
90
108
    struct sockaddr_in local;
91
109
    local.sin_family = AF_INET;
92
110
    local.sin_port = static_cast<unsigned short int>( htons( m_port ) );