Allow setting host on local connections

This commit is contained in:
simon.kagstrom 2009-03-01 14:27:17 +00:00
parent cca6c03c00
commit a81356aee7
3 changed files with 14 additions and 9 deletions

View File

@ -24,7 +24,7 @@
/* TODO: */
extern char *fixme_tmp_network_client;
extern int fixme_tmp_network_server;
extern char *fixme_tmp_network_server;
static struct timeval tv_start;
@ -79,7 +79,7 @@ void C64::c64_ctor1(void)
this->peer = NULL;
if (fixme_tmp_network_server) {
int i;
strcpy(this->server_hostname, fixme_tmp_network_server);
this->peer = new Network(this->server_hostname, this->server_port, true);
this->network_connection_type = MASTER;
printf("Waiting for connection\n");

View File

@ -945,6 +945,7 @@ bool Network::ConnectFSM()
this->network_connection_state = CONN_CONNECT_TO_PEER;
break;
case CONN_CONNECT_TO_PEER:
printf("Connecting to peer\n");
if (this->ConnectToPeer() == false)
return false;
/* Allow some transit time */
@ -954,10 +955,13 @@ bool Network::ConnectFSM()
case CONN_WAIT_FOR_PEER_REPLY:
/* Connect again in case the first sent was dropped on
* its way to the peer */
printf("Connecting to peer again\n");
if (this->ConnectToPeer() == false)
return false;
printf("Waiting for peer reply\n");
if (this->WaitForPeerReply() == false)
return false;
printf("Got peer reply\n");
this->network_connection_state = CONN_CONNECTED;
break;
case CONN_CONNECTED:

View File

@ -104,16 +104,17 @@ Frodo::Frodo()
* Process command line arguments
*/
char *fixme_tmp_network_client = 0;
int fixme_tmp_network_server = 0;
char *fixme_tmp_network_server = 0;
void Frodo::ArgvReceived(int argc, char **argv)
{
if (argc == 2 &&
strcmp(argv[1], "-s") == 0)
fixme_tmp_network_server = 1;
if (argc == 3 &&
strcmp(argv[1], "-c") == 0)
fixme_tmp_network_client = argv[2];
if (argc == 3)
{
if (strcmp(argv[1], "-s") == 0)
fixme_tmp_network_server = argv[2];
else if (strcmp(argv[1], "-c") == 0)
fixme_tmp_network_client = argv[2];
}
}