Skip to content

Commit

Permalink
remove unused custom messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Jan 4, 2024
1 parent 5a89791 commit e6ab83e
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions hxbit/NetworkHost.hx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class NetworkClient {

if( !wasSync && !host.isAuth ) {
switch( mid ) {
case NetworkHost.FULLSYNC, NetworkHost.MSG, NetworkHost.BMSG, NetworkHost.CUSTOM, NetworkHost.BCUSTOM:
case NetworkHost.FULLSYNC, NetworkHost.MSG, NetworkHost.BMSG:
default:
host.logError("Message "+mid+" was received before sync");
}
Expand Down Expand Up @@ -301,13 +301,6 @@ class NetworkClient {
var msg = ctx.getBytes();
host.onMessage(this, msg);

case NetworkHost.CUSTOM:
host.onCustom(this, ctx.getInt(), null);

case NetworkHost.BCUSTOM:
var id = ctx.getInt();
host.onCustom(this, id, ctx.getBytes());

#if hxbit_visibility
case NetworkHost.VIS_RESET:
var oid = ctx.getUID();
Expand Down Expand Up @@ -434,8 +427,6 @@ class NetworkHost {
static inline var RPC_RESULT = 7;
static inline var MSG = 8;
static inline var BMSG = 9;
static inline var CUSTOM = 10;
static inline var BCUSTOM = 11;
static inline var CANCEL_RPC = 12;
static inline var VIS_RESET = 13;
static inline var EOM = 0xFF;
Expand Down Expand Up @@ -613,9 +604,6 @@ class NetworkHost {
public dynamic function onSync( obj : hxbit.NetworkSerializable, bits1 : Int, bits2 : Int ) {
}

function onCustom( from : NetworkClient, id : Int, ?data : haxe.io.Bytes ) {
}

public function sendMessage( msg : Dynamic, ?to : NetworkClient ) {
flush();
var prev = targetClient;
Expand All @@ -632,18 +620,6 @@ class NetworkHost {
targetClient = prev;
}

function sendCustom( id : Int, ?data : haxe.io.Bytes, ?to : NetworkClient ) {
flush();
var prev = targetClient;
targetClient = to;
ctx.addByte(data == null ? CUSTOM : BCUSTOM);
ctx.addInt(id);
if( data != null ) ctx.addBytes(data);
if( checkEOM ) ctx.addByte(EOM);
doSend();
targetClient = prev;
}

function setTargetOwner( owner : NetworkSerializable ) {
if( !isAuth )
return true;
Expand Down Expand Up @@ -1179,16 +1155,6 @@ class NetworkHost {
markHead = null;
}

function isCustomMessage( bytes : haxe.io.Bytes, id : Int, pos = 0 ) {
if( bytes.length - pos < 2 )
return false;
ctx.setInput(bytes, pos);
var k = ctx.getByte();
if( k != CUSTOM && k != BCUSTOM )
return false;
return ctx.getInt() == id;
}

public function flush() {
flushProps();
if( @:privateAccess globalCtx.out.length > 0 ) doSend();
Expand Down

0 comments on commit e6ab83e

Please sign in to comment.