Ticket #7839: 7839-tcp_keepalive.patch
File 7839-tcp_keepalive.patch, 3.2 KB (added by , 14 years ago) |
---|
-
libs/libmythdb/msocketdevice_win.cpp
306 306 case SendBuffer: 307 307 n = SO_SNDBUF; 308 308 break; 309 case Keepalive: 310 n = SO_KEEPALIVE; 311 break; 309 312 } 310 313 if ( n != -1 ) { 311 314 SOCKLEN_T len = sizeof(v); … … 361 364 case SendBuffer: 362 365 n = SO_SNDBUF; 363 366 break; 367 case Keepalive: 368 n = SO_KEEPALIVE; 369 break; 364 370 default: 365 371 return; 366 372 } -
libs/libmythdb/msocketdevice.cpp
446 446 447 447 448 448 /*! 449 Returns true if this socket has the keepalive option set. 450 451 \sa setKeepalive() 452 */ 453 bool MSocketDevice::keepalive() const 454 { 455 return option( Keepalive ); 456 } 457 458 /*! 459 Sets the keepalive option for this socket. 460 461 \sa keepalive() 462 */ 463 void MSocketDevice::setKeepalive( bool enable ) 464 { 465 setOption( Keepalive, enable ); 466 } 467 468 469 /*! 449 470 Returns the size of the operating system receive buffer. 450 471 451 472 \sa setReceiveBufferSize() -
libs/libmythdb/msocketdevice_unix.cpp
303 303 case SendBuffer: 304 304 n = SO_SNDBUF; 305 305 break; 306 case Keepalive: 307 n = SO_KEEPALIVE; 308 break; 306 309 } 307 310 if ( n != -1 ) { 308 311 QT_SOCKOPTLEN_T len; … … 352 355 case SendBuffer: 353 356 n = SO_SNDBUF; 354 357 break; 358 case Keepalive: 359 n = SO_KEEPALIVE; 360 break; 355 361 default: 356 362 return; 357 363 } -
libs/libmythdb/mythsocket.cpp
41 41 if (socket > -1) 42 42 { 43 43 setSocket(socket); 44 setKeepalive(true); 44 45 #ifdef USING_MINGW 45 46 // Windows sockets' default buffersize is too small for streaming 46 47 // Could this apply to other platforms, too? … … 696 697 697 698 setReceiveBufferSize(kSocketBufferSize); 698 699 setAddressReusable(true); 700 setKeepalive(true); 699 701 if (state() == Connecting) 700 702 { 701 703 setState(Connected); -
libs/libmythdb/msocketdevice.h
94 94 int sendBufferSize() const; 95 95 virtual void setSendBufferSize( uint ); 96 96 97 bool keepalive() const; 98 virtual void setKeepalive( bool ); 99 97 100 virtual bool connect( const QHostAddress &, quint16 ); 98 101 99 102 virtual bool bind( const QHostAddress &, quint16 ); … … 146 149 MSocketDevice::Error e; 147 150 MSocketDevicePrivate * d; 148 151 149 enum Option { Broadcast, ReceiveBuffer, ReuseAddress, SendBuffer };152 enum Option { Broadcast, ReceiveBuffer, ReuseAddress, SendBuffer, Keepalive }; 150 153 151 154 int option( Option ) const; 152 155 virtual void setOption( Option, int );