Changeset 219:c8c7e9957cc5 in roaraudio


Ignore:
Timestamp:
07/21/08 23:13:26 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

check if getsockopt(, IPPROTO_TCP, TCP_CORK, ) work. if not do not try setsockopt(), this should seed up a bit as we do not do two kernel calls if not needed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/file.c

    r217 r219  
    3131 socklen_t cork_len = sizeof(int); 
    3232 
    33  getsockopt(out, IPPROTO_TCP, TCP_CORK, &cork_old, &cork_len); 
    34  setsockopt(out, IPPROTO_TCP, TCP_CORK, &cork_new, sizeof(int)); 
     33 if ( getsockopt(out, IPPROTO_TCP, TCP_CORK, &cork_old, &cork_len) == -1 ) { 
     34  cork_old = -1; 
     35 } else { 
     36  setsockopt(out, IPPROTO_TCP, TCP_CORK, &cork_new, sizeof(int)); 
     37 } 
    3538#endif 
    3639 
     
    4649 
    4750#ifdef __linux__ 
    48  setsockopt(out, IPPROTO_TCP, TCP_CORK, &cork_old, cork_len); 
     51 if ( cork_old != -1 ) 
     52  setsockopt(out, IPPROTO_TCP, TCP_CORK, &cork_old, cork_len); 
    4953#endif 
    5054 return r; 
Note: See TracChangeset for help on using the changeset viewer.