Commit e2c336aa authored by Guilherme Lepsch's avatar Guilherme Lepsch
Browse files

[FTC-253] Operação GetPosition retorna uma resposta incorreta quando conectado...

[FTC-253] Operação GetPosition retorna uma resposta incorreta quando conectado com clientes com protocolo versão 1.2

git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/ftc/core/csharp/trunk@136659 ae0415b3-e90b-0410-900d-d0be9363c56b
parent 5aae9f21
No related merge requests found
Pipeline #681 skipped
Showing with 18 additions and 3 deletions
+18 -3
......@@ -43,7 +43,12 @@ namespace Tecgraf.Ftc.V1_4_0.Server.States.V1_2
/// <summary>
/// A posição do arquivo.
/// </summary>
private long position;
private long position = -1;
/// <summary>
/// O código de erro.
/// </summary>
private ErrorCode errorCode = ErrorCode.FAILURE;
/// <summary>
/// Objeto responsável por registrar as atividades do servidor.
......@@ -85,6 +90,7 @@ namespace Tecgraf.Ftc.V1_4_0.Server.States.V1_2
{
logger.Info("Posicao atual: " + position);
}
this.errorCode = ErrorCode.OK;
}
catch (Exception e)
{
......@@ -98,8 +104,17 @@ namespace Tecgraf.Ftc.V1_4_0.Server.States.V1_2
logger.Info("Operação GET_POSITION não suportada pelo canal");
}
buffer.Limit = (int)PrimitiveTypeSize.LONG;
buffer.WriteLong(this.position);
if (this.errorCode == ErrorCode.OK)
{
buffer.Limit = (int)PrimitiveTypeSize.BYTE + (int)PrimitiveTypeSize.LONG;
buffer.WriteByte((byte)this.errorCode);
buffer.WriteLong(this.position);
}
else
{
buffer.Limit = (int)PrimitiveTypeSize.BYTE;
buffer.WriteByte((byte)this.errorCode);
}
buffer.Flip();
if (logger.IsInfoEnabled)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment