Skip to content

Commit

Permalink
More conservative default MTU, and react to MSGSIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
keithw committed Oct 16, 2012
1 parent be3b125 commit 39276a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/network/network.cc
Expand Up @@ -198,7 +198,7 @@ Connection::Connection( const char *desired_ip, const char *desired_port ) /* se
has_remote_addr( false ),
remote_addr(),
server( true ),
MTU( SEND_MTU ),
MTU( DEFAULT_SEND_MTU ),
key(),
session( key ),
direction( TO_CLIENT ),
Expand Down Expand Up @@ -310,7 +310,7 @@ Connection::Connection( const char *key_str, const char *ip, int port ) /* clien
has_remote_addr( false ),
remote_addr(),
server( false ),
MTU( SEND_MTU ),
MTU( DEFAULT_SEND_MTU ),
key( key_str ),
session( key ),
direction( TO_SERVER ),
Expand Down Expand Up @@ -363,6 +363,10 @@ void Connection::send( string s )
flight anyway. */
have_send_exception = true;
send_exception = NetworkException( "sendto", errno );

if ( errno == EMSGSIZE ) {
MTU = 500; /* payload MTU of last resort */
}
}

uint64_t now = timestamp();
Expand Down
2 changes: 1 addition & 1 deletion src/network/network.h
Expand Up @@ -86,7 +86,7 @@ namespace Network {

class Connection {
private:
static const int SEND_MTU = 1400;
static const int DEFAULT_SEND_MTU = 1300;
static const uint64_t MIN_RTO = 50; /* ms */
static const uint64_t MAX_RTO = 1000; /* ms */

Expand Down

0 comments on commit 39276a4

Please sign in to comment.