Skip to content

Commit

Permalink
Don't use smart pointers in client_t
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Feb 12, 2015
1 parent 28655ac commit 0f2de16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/engine/server/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ typedef struct client_s

// downloading
char downloadName[ MAX_QPATH ]; // if not empty string, we are downloading
std::shared_ptr<FS::File> download; // file being downloaded (Using shared_ptr to work around MSVC failing at infering move constructors)
FS::File* download; // file being downloaded
int downloadSize; // total bytes (can't use EOF because of paks)
int downloadCount; // bytes sent
int downloadClientBlock; // last block we sent to the client, awaiting ack
Expand Down
3 changes: 2 additions & 1 deletion src/engine/server/sv_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ static void SV_CloseDownload( client_t *cl )
// EOF
if ( cl->download )
{
delete cl->download;
cl->download = nullptr;
}

Expand Down Expand Up @@ -1066,7 +1067,7 @@ void SV_WriteDownloadToClient( client_t *cl, msg_t *msg )
const FS::PakInfo* pak = checksum ? FS::FindPak(name, version) : FS::FindPak(name, version, *checksum);
if (pak) {
try {
cl->download = std::make_shared<FS::File>(FS::RawPath::OpenRead(pak->path));
cl->download = new FS::File(FS::RawPath::OpenRead(pak->path));
cl->downloadSize = cl->download->Length();
} catch (std::system_error&) {
success = false;
Expand Down

0 comments on commit 0f2de16

Please sign in to comment.