mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2025-02-18 05:16:19 +01:00
Correct a few connection bugs
This commit is contained in:
parent
bef194c90e
commit
c97ab6801b
@ -996,7 +996,7 @@ bool Network::AppendScreenshot(NetworkUpdatePeerInfo *pi)
|
|||||||
if (!png)
|
if (!png)
|
||||||
goto out_scr;
|
goto out_scr;
|
||||||
|
|
||||||
ud = InitNetworkUpdate(this->ud, REGISTER_DATA,
|
ud = InitNetworkUpdate(this->cur_ud, REGISTER_DATA,
|
||||||
sizeof(NetworkUpdate) + sizeof(NetworkUpdateRegisterData) + sz);
|
sizeof(NetworkUpdate) + sizeof(NetworkUpdateRegisterData) + sz);
|
||||||
dsu = (NetworkUpdateRegisterData *)ud->data;
|
dsu = (NetworkUpdateRegisterData *)ud->data;
|
||||||
dsu->key = DataStore::ds->getNextKey();
|
dsu->key = DataStore::ds->getNextKey();
|
||||||
@ -1015,7 +1015,7 @@ out_none:
|
|||||||
|
|
||||||
bool Network::ConnectToBroker()
|
bool Network::ConnectToBroker()
|
||||||
{
|
{
|
||||||
NetworkUpdate *ud = InitNetworkUpdate(this->ud, CONNECT_TO_BROKER,
|
NetworkUpdate *ud = InitNetworkUpdate(this->cur_ud, CONNECT_TO_BROKER,
|
||||||
sizeof(NetworkUpdate) + sizeof(NetworkUpdatePeerInfo));
|
sizeof(NetworkUpdate) + sizeof(NetworkUpdatePeerInfo));
|
||||||
NetworkUpdatePeerInfo *pi = (NetworkUpdatePeerInfo *)ud->data;
|
NetworkUpdatePeerInfo *pi = (NetworkUpdatePeerInfo *)ud->data;
|
||||||
bool out;
|
bool out;
|
||||||
@ -1125,6 +1125,8 @@ network_connection_error_t Network::WaitForPeerList()
|
|||||||
if (pi->peers[i].version != FRODO_NETWORK_PROTOCOL_VERSION)
|
if (pi->peers[i].version != FRODO_NETWORK_PROTOCOL_VERSION)
|
||||||
return VERSION_ERROR;
|
return VERSION_ERROR;
|
||||||
}
|
}
|
||||||
|
if (pi->n_peers == 0)
|
||||||
|
return NO_PEERS_ERROR;
|
||||||
|
|
||||||
Gui::gui->nuv->setPeers(pi);
|
Gui::gui->nuv->setPeers(pi);
|
||||||
Gui::gui->activate();
|
Gui::gui->activate();
|
||||||
@ -1279,7 +1281,6 @@ network_connection_error_t Network::ConnectFSM()
|
|||||||
} break;
|
} break;
|
||||||
case CONN_WAIT_FOR_PEER_ADDRESS:
|
case CONN_WAIT_FOR_PEER_ADDRESS:
|
||||||
Gui::gui->status_bar->queueMessage("Waiting for connection...");
|
Gui::gui->status_bar->queueMessage("Waiting for connection...");
|
||||||
TheC64->TheDisplay->display_status_string((char*)"WAITING FOR CONNECTION...", 1);
|
|
||||||
err = this->WaitForPeerAddress();
|
err = this->WaitForPeerAddress();
|
||||||
if (err == OK)
|
if (err == OK)
|
||||||
this->network_connection_state = CONN_CONNECT_TO_PEER;
|
this->network_connection_state = CONN_CONNECT_TO_PEER;
|
||||||
@ -1289,7 +1290,14 @@ network_connection_error_t Network::ConnectFSM()
|
|||||||
case CONN_WAIT_FOR_PEER_LIST:
|
case CONN_WAIT_FOR_PEER_LIST:
|
||||||
Gui::gui->status_bar->queueMessage("Waiting for peer list...");
|
Gui::gui->status_bar->queueMessage("Waiting for peer list...");
|
||||||
/* Also tells the broker that we want to connect */
|
/* Also tells the broker that we want to connect */
|
||||||
return this->WaitForPeerList();
|
err = this->WaitForPeerList();
|
||||||
|
if (err == NO_PEERS_ERROR)
|
||||||
|
{
|
||||||
|
this->network_connection_state = CONN_WAIT_FOR_PEER_ADDRESS;
|
||||||
|
this->is_master = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this->network_connection_state = CONN_WAIT_FOR_PEER_SELECT;
|
||||||
break;
|
break;
|
||||||
case CONN_WAIT_FOR_PEER_SELECT:
|
case CONN_WAIT_FOR_PEER_SELECT:
|
||||||
err = this->WaitForPeerSelection();
|
err = this->WaitForPeerSelection();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user