Skip to content

Commit

Permalink
Serve content from single server--no sharding
Browse files Browse the repository at this point in the history
  • Loading branch information
ravinet committed Dec 22, 2014
1 parent 7a61523 commit b880bb6
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions replayshell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,28 @@ int main( int argc, char *argv[] )

/* set up dummy interfaces */
unsigned int interface_counter = 0;
bool one_interface = true;
string list_ip;
for ( const auto ip : unique_ip ) {
add_dummy_interface( "sharded" + to_string( interface_counter ), ip );
interface_counter++;
if ( one_interface ) {
add_dummy_interface( "sharded" + to_string( interface_counter ), ip );
list_ip = ip.ip();
interface_counter++;
one_interface = false;
}
}

/* set up web servers */
vector< WebServer > servers;
for ( const auto ip_port : unique_ip_and_port ) {
servers.emplace_back( ip_port, directory );
}
Address non_ssl = Address( list_ip, 80 );
Address ssl = Address ( list_ip, 443);
servers.emplace_back( non_ssl, directory );
servers.emplace_back( ssl, directory );

/* set up DNS server */
TempFile dnsmasq_hosts( "/tmp/replayshell_hosts" );
for ( const auto mapping : hostname_to_ip ) {
dnsmasq_hosts.write( mapping.second.ip() + " " + mapping.first + "\n" );
dnsmasq_hosts.write( list_ip + " " + mapping.first + "\n" );
}

/* initialize event loop */
Expand Down

0 comments on commit b880bb6

Please sign in to comment.