private void RecvWants()
{
bool isFirst = true;
for (; ; isFirst = false)
{
string line;
try
{
line = _pckIn.ReadString();
}
catch (EndOfStreamException)
{
if (isFirst) break;
throw;
}
if (line.Length == 0) break;
if (!line.StartsWith("want ") || line.Length < 45)
{
throw new PackProtocolException("expected want; got " + line);
}
if (isFirst)
{
int sp = line.IndexOf(' ', 45);
if (sp >= 0)
{
foreach (string c in line.Substring(sp + 1).Split(' '))
_options.Add(c);
line = line.Slice(0, sp);
}
}
string name = line.Substring(5);
ObjectId id = ObjectId.FromString(name);
RevObject o;
try
{
o = _walk.parseAny(id);
}
catch (IOException e)
{
throw new PackProtocolException(name + " not valid", e);
}
if (!o.has(ADVERTISED))
{
throw new PackProtocolException(name + " not valid");
}
Want(o);
}
}