version 1.171, 2010/11/05 02:46:47 |
version 1.172, 2010/11/13 23:27:50 |
|
|
} |
} |
|
|
static void |
static void |
packet_set_tos(int interactive) |
packet_set_tos(int tos) |
{ |
{ |
int tos = interactive ? IPTOS_LOWDELAY : IPTOS_THROUGHPUT; |
|
|
|
if (!packet_connection_is_on_socket() || |
if (!packet_connection_is_on_socket() || |
!packet_connection_is_ipv4()) |
!packet_connection_is_ipv4()) |
return; |
return; |
|
debug3("%s: set IP_TOS 0x%02x", __func__, tos); |
if (setsockopt(active_state->connection_in, IPPROTO_IP, IP_TOS, &tos, |
if (setsockopt(active_state->connection_in, IPPROTO_IP, IP_TOS, &tos, |
sizeof(tos)) < 0) |
sizeof(tos)) < 0) |
error("setsockopt IP_TOS %d: %.100s:", |
error("setsockopt IP_TOS %d: %.100s:", |
|
|
/* Informs that the current session is interactive. Sets IP flags for that. */ |
/* Informs that the current session is interactive. Sets IP flags for that. */ |
|
|
void |
void |
packet_set_interactive(int interactive) |
packet_set_interactive(int interactive, int qos_interactive, int qos_bulk) |
{ |
{ |
if (active_state->set_interactive_called) |
if (active_state->set_interactive_called) |
return; |
return; |
|
|
if (!packet_connection_is_on_socket()) |
if (!packet_connection_is_on_socket()) |
return; |
return; |
set_nodelay(active_state->connection_in); |
set_nodelay(active_state->connection_in); |
packet_set_tos(interactive); |
packet_set_tos(interactive ? qos_interactive : qos_bulk); |
} |
} |
|
|
/* Returns true if the current connection is interactive. */ |
/* Returns true if the current connection is interactive. */ |