Skip to content

Commit 500f01f

Browse files
authored
Merge pull request #245 from thegrb93/fix-unused-umsg
Remove unused umsg
2 parents 232bb51 + 42cb82c commit 500f01f

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

lua/advdupe2/sv_file.lua

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,7 @@ end
111111

112112
local function AdvDupe2_ReceiveFile(len, ply)
113113
if(not IsValid(ply))then return end
114-
115-
if ply.AdvDupe2.Uploading then
116-
umsg.Start("AdvDupe2_UploadRejected", ply)
117-
umsg.Bool(false)
118-
umsg.End()
119-
AdvDupe2.Notify(ply, "Duplicator is Busy!",NOTIFY_ERROR,5)
120-
return
121-
end
122-
123-
ply.AdvDupe2.Uploading = true
124-
AdvDupe2.InitProgressBar(ply, "Opening: ")
125-
114+
126115
local name = net.ReadString()
127116
local _1, _2, _3 = string.find(name, "([%w_]+)")
128117
if _3 then
@@ -131,13 +120,23 @@ local function AdvDupe2_ReceiveFile(len, ply)
131120
ply.AdvDupe2.Name = "Advanced Duplication"
132121
end
133122

134-
net.ReadStream(ply, function(data)
135-
AdvDupe2.LoadDupe(ply, AdvDupe2.Decode(data))
123+
local stream = net.ReadStream(ply, function(data)
124+
if data then
125+
AdvDupe2.LoadDupe(ply, AdvDupe2.Decode(data))
126+
else
127+
AdvDupe2.Notify(ply, "Duplicator Upload Failed!", NOTIFY_ERROR, 5)
128+
end
136129
ply.AdvDupe2.Uploading = false
137-
138-
umsg.Start("AdvDupe2_UploadRejected", ply)
139-
umsg.Bool(true)
140-
umsg.End()
141130
end)
131+
132+
if ply.AdvDupe2.Uploading then
133+
if stream then
134+
stream:Remove()
135+
end
136+
AdvDupe2.Notify(ply, "Duplicator is Busy!", NOTIFY_ERROR, 5)
137+
elseif stream then
138+
ply.AdvDupe2.Uploading = true
139+
AdvDupe2.InitProgressBar(ply, "Opening: ")
140+
end
142141
end
143142
net.Receive("AdvDupe2_ReceiveFile", AdvDupe2_ReceiveFile)

0 commit comments

Comments
 (0)