handling tcp close event in netty server

while the file is in uploading state and connection is reset by peer,
volume upload request posted again shows the upload is IN_Progress
state. marking them as errored
This commit is contained in:
Rajani Karuturi 2015-03-17 15:17:33 +05:30
parent 7d1ca8a55c
commit 6b8b4b92e6
2 changed files with 8 additions and 1 deletions

View File

@ -94,6 +94,13 @@ public class HttpUploadServerHandler extends SimpleChannelInboundHandler<HttpObj
}
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
String message = "file receive failed or connection closed prematurely.";
logger.error(message);
storageResource.updateStateMapWithError(uuid, message);
}
@Override
public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
if (msg instanceof HttpRequest) {

View File

@ -2774,7 +2774,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
return _ssvmPSK;
}
private void updateStateMapWithError(String uuid,String errorMessage) {
public void updateStateMapWithError(String uuid,String errorMessage) {
UploadEntity uploadEntity=null;
if (uploadEntityStateMap.get(uuid)!=null) {
uploadEntity=uploadEntityStateMap.get(uuid);