1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-22 22:07:31 +03:00

Fixed "disconnected" bug / Updated menu music

This commit is contained in:
Anuken 2019-09-01 10:19:13 -04:00
parent 1cd43f938f
commit d481af43c7
2 changed files with 28 additions and 0 deletions

Binary file not shown.

View File

@ -103,6 +103,34 @@ public class ArcNetServer implements ServerProvider{
return null;
}
@Override
public void sendStream(int id, Streamable stream){
ArcConnection connection = getByID(id);
if(connection == null) return;
connection.connection.addListener(new InputStreamSender(stream.stream, 512){
int id;
@Override
protected void start(){
//send an object so the receiving side knows how to handle the following chunks
StreamBegin begin = new StreamBegin();
begin.total = stream.stream.available();
begin.type = Registrator.getID(stream.getClass());
connection.connection.sendTCP(begin);
id = begin.id;
}
@Override
protected Object next(byte[] bytes){
StreamChunk chunk = new StreamChunk();
chunk.id = id;
chunk.data = bytes;
return chunk; //wrap the byte[] with an object so the receiving side knows how to handle it.
}
});
}
@Override
public void host(int port) throws IOException{
connections.clear();