Skip to content

Commit 1be32c5

Browse files
authored
Fix a bug when sending a file (#92)
1 parent a2ebdb5 commit 1be32c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

trantor/net/inner/TcpConnectionImpl.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,8 +1201,8 @@ void TcpConnectionImpl::sendFileInLoop(const BufferNodePtr &filePtr)
12011201
while (filePtr->fileBytesToSend_ > 0)
12021202
{
12031203
auto n = fread(&(*fileBufferPtr_)[0],
1204-
fileBufferPtr_->size(),
12051204
1,
1205+
fileBufferPtr_->size(),
12061206
filePtr->sendFp_);
12071207
#endif
12081208
if (n > 0)
@@ -1240,7 +1240,7 @@ void TcpConnectionImpl::sendFileInLoop(const BufferNodePtr &filePtr)
12401240
LOG_SYSERR << "Unexpected error(" << errno << ")";
12411241
return;
12421242
}
1243-
return;
1243+
break;
12441244
}
12451245
}
12461246
if (n < 0)
@@ -1253,7 +1253,7 @@ void TcpConnectionImpl::sendFileInLoop(const BufferNodePtr &filePtr)
12531253
if (n == 0)
12541254
{
12551255
LOG_SYSERR << "read";
1256-
break;
1256+
return;
12571257
}
12581258
}
12591259
if (!ioChannelPtr_->isWriting())

0 commit comments

Comments
 (0)