Skip to content

Commit

Permalink
Merge pull request #62 from The-any-Key/Network_interference_fix
Browse files Browse the repository at this point in the history
Network interference fix
  • Loading branch information
The-any-Key authored Nov 12, 2017
2 parents 56ed440 + 216c914 commit 2d0e9ea
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ var in_ip = ds_map_find_value(async_load, "ip");
var in_buff = ds_map_find_value(async_load, "buffer");
var in_id = ds_map_find_value(async_load, "id");
var in_port = ds_map_find_value(async_load, "port");
buffer_seek(in_buff, buffer_seek_start, 0);

//Check that the packet is from the server
if (in_ip == self.server_ip) {
buffer_seek(in_buff, buffer_seek_start, 0);
//Read command
switch buffer_read(in_buff, buffer_s8 ) {
case htme_packet.PING:
Expand Down
2 changes: 1 addition & 1 deletion GMnetENGINE.gmx/scripts/htme_clientConnectNetworking.gml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ var in_ip = ds_map_find_value(async_load, "ip");
var in_buff = ds_map_find_value(async_load, "buffer");
var in_id = ds_map_find_value(async_load, "id");
var in_port = ds_map_find_value(async_load, "port");
buffer_seek(in_buff, buffer_seek_start, 0);

//SCENARIO: Client that is not yet on the players list connected.
//For some akward reasons, in_ip is empty when the server contacts the client, we are
//assuming only the server knows this endpoint.

//Check that the master server didn't send us a packet!
if (!self.use_udphp || (in_ip != self.udphp_master_ip)) {
buffer_seek(in_buff, buffer_seek_start, 0);
//Read command
switch buffer_read(in_buff, buffer_s8 ) {
case htme_packet.SERVER_CONREQACCEPT:
Expand Down
2 changes: 1 addition & 1 deletion GMnetENGINE.gmx/scripts/htme_recieveSignedPackets.gml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ var in_buff = ds_map_find_value(async_load, "buffer");
var in_id = ds_map_find_value(async_load, "id");
var in_port = ds_map_find_value(async_load, "port");

buffer_seek(in_buff, buffer_seek_start, 0);
//Create playermap if it doesn't exist, fix for YYC compatibility
if not ds_exists(self.playermap,ds_type_map)
self.playermap = ds_map_create()

//Check if the sender is valid
if ((self.isServer && !is_undefined(ds_map_find_value(self.playermap,in_ip+":"+string(in_port)))) ||
(!self.isServer && in_ip == self.server_ip && in_port == self.server_port)) {
buffer_seek(in_buff, buffer_seek_start, 0);
//Read command
var code = buffer_read(in_buff, buffer_s8 );
switch code {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ var in_ip = ds_map_find_value(async_load, "ip");
var in_buff = ds_map_find_value(async_load, "buffer");
var in_id = ds_map_find_value(async_load, "id");
var in_port = ds_map_find_value(async_load, "port");
buffer_seek(in_buff, buffer_seek_start, 0);

var player = ds_map_find_value(self.playermap,in_ip+":"+string(in_port));

//Check that the packet is from a valid client
if (!is_undefined(player)) {
buffer_seek(in_buff, buffer_seek_start, 0);
//Read command
switch buffer_read(in_buff, buffer_s8 ) {
case htme_packet.PING:
Expand Down
2 changes: 1 addition & 1 deletion GMnetENGINE.gmx/scripts/htme_serverConnectNetworking.gml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ var in_ip = ds_map_find_value(async_load, "ip");
var in_buff = ds_map_find_value(async_load, "buffer");
var in_id = ds_map_find_value(async_load, "id");
var in_port = ds_map_find_value(async_load, "port");
buffer_seek(in_buff, buffer_seek_start, 0);

//SCENARIO: Client that is not yet on the players list connected.
if (is_undefined(ds_map_find_value(self.playermap,in_ip+":"+string(in_port)))) {
buffer_seek(in_buff, buffer_seek_start, 0);
//Read command
switch buffer_read(in_buff, buffer_s8) {
case htme_packet.CLIENT_REQUESTCONNECT:
Expand Down
2 changes: 1 addition & 1 deletion GMnetENGINE.gmx/scripts/udphp_downloadNetworking.gml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ var in_port = ds_map_find_value(async_load, "port");

//Only continue if this is for the "lobby socket"
if (in_id != global.udphp_downloadServerlistSocket) exit;
buffer_seek(in_buff, buffer_seek_start, 0);

if (in_ip == global.udphp_master) {
buffer_seek(in_buff, buffer_seek_start, 0);
udphp_handleerror(udphp_dbglvl.DEBUG, udphp_dbgtarget.MAIN, 0, "Downloader: Got message from master server");
//Read command
var com = buffer_read(in_buff, buffer_s8 );
Expand Down
3 changes: 1 addition & 2 deletions GMnetENGINE.gmx/scripts/udphp_serverNetworking.gml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ var in_port = ds_map_find_value(async_load, "port");
var incoming_requests = global.udphp_server_incoming_requests;
var incoming_requests2 = global.udphp_server_incoming_requests2;
var players = global.udphp_server_players;
buffer_seek(in_buff, buffer_seek_start, 0);

//Only continue if this is for the server
if (in_id != global.udphp_server_udp and in_id != global.udphp_server_tcp) exit;

buffer_seek(in_buff, buffer_seek_start, 0);

//SCENARIO 1: Master server sends client information! Somebody wants to connect
if (in_ip == global.udphp_master and in_id == global.udphp_server_tcp) {
Expand Down

0 comments on commit 2d0e9ea

Please sign in to comment.