mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-11-14 14:18:50 +03:00
Fixed "disconnected" bug / Updated menu music
This commit is contained in:
parent
1cd43f938f
commit
d481af43c7
Binary file not shown.
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user