Small cleanup to SocketOutput's shutdown logic

This commit is contained in:
Stephen Halter 2016-06-01 12:04:48 -07:00
parent 07744e75d9
commit 6bff2ecb34
2 changed files with 6 additions and 12 deletions

View File

@ -248,7 +248,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
public void ProducingComplete(MemoryPoolIterator end) public void ProducingComplete(MemoryPoolIterator end)
{ {
if(_lastStart.IsDefault) if (_lastStart.IsDefault)
{ {
return; return;
} }
@ -560,7 +560,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
public int WriteStatus; public int WriteStatus;
public Exception WriteError; public Exception WriteError;
public int ShutdownSendStatus;
public WriteContext(SocketOutput self) public WriteContext(SocketOutput self)
{ {
@ -625,15 +624,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
var shutdownReq = new UvShutdownReq(Self._log); var shutdownReq = new UvShutdownReq(Self._log);
shutdownReq.Init(Self._thread.Loop); shutdownReq.Init(Self._thread.Loop);
shutdownReq.Shutdown(Self._socket, (_shutdownReq, status, state) => shutdownReq.Shutdown(Self._socket, (req, status, state) =>
{ {
_shutdownReq.Dispose(); req.Dispose();
var _this = (WriteContext)state;
_this.ShutdownSendStatus = status;
_this.Self._log.ConnectionWroteFin(_this.Self._connectionId, status); var writeContext = (WriteContext)state;
writeContext.Self._log.ConnectionWroteFin(writeContext.Self._connectionId, status);
_this.DoDisconnectIfNeeded(); writeContext.DoDisconnectIfNeeded();
}, this); }, this);
} }
@ -762,8 +759,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
WriteStatus = 0; WriteStatus = 0;
WriteError = null; WriteError = null;
ShutdownSendStatus = 0;
} }
} }

View File

@ -683,7 +683,6 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
Assert.True(start.IsDefault); Assert.True(start.IsDefault);
// ProducingComplete should not throw given a default iterator // ProducingComplete should not throw given a default iterator
socketOutput.ProducingComplete(start); socketOutput.ProducingComplete(start);
} }
} }
} }