Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
e76502cf
Commit
e76502cf
authored
May 01, 2012
by
Max-Wilhelm Bruker
Browse files
handle dead commands when the connection is lost before the reply gets processed
parent
53afd65b
Changes
4
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/remoteclient.cpp
View file @
e76502cf
...
...
@@ -166,8 +166,14 @@ void RemoteClient::doDisconnectFromServer()
messageLength
=
0
;
QList
<
PendingCommand
*>
pc
=
pendingCommands
.
values
();
for
(
int
i
=
0
;
i
<
pc
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
pc
.
size
();
i
++
)
{
Response
response
;
response
.
set_response_code
(
Response
::
RespNotConnected
);
response
.
set_cmd_id
(
pc
[
i
]
->
getCommandContainer
().
cmd_id
());
pc
[
i
]
->
processResponse
(
response
);
delete
pc
[
i
];
}
pendingCommands
.
clear
();
setStatus
(
StatusDisconnected
);
...
...
cockatrice/src/tab_deck_storage.cpp
View file @
e76502cf
...
...
@@ -177,6 +177,9 @@ void TabDeckStorage::actUpload()
void
TabDeckStorage
::
uploadFinished
(
const
Response
&
r
,
const
CommandContainer
&
commandContainer
)
{
if
(
r
.
response_code
()
!=
Response
::
RespOk
)
return
;
const
Response_DeckUpload
&
resp
=
r
.
GetExtension
(
Response_DeckUpload
::
ext
);
const
Command_DeckUpload
&
cmd
=
commandContainer
.
session_command
(
0
).
GetExtension
(
Command_DeckUpload
::
ext
);
...
...
@@ -208,6 +211,9 @@ void TabDeckStorage::actOpenRemoteDeck()
void
TabDeckStorage
::
openRemoteDeckFinished
(
const
Response
&
r
)
{
if
(
r
.
response_code
()
!=
Response
::
RespOk
)
return
;
const
Response_DeckDownload
&
resp
=
r
.
GetExtension
(
Response_DeckDownload
::
ext
);
// WndDeckEditor *deckEditor = new WndDeckEditor;
...
...
@@ -243,6 +249,9 @@ void TabDeckStorage::actDownload()
void
TabDeckStorage
::
downloadFinished
(
const
Response
&
r
,
const
CommandContainer
&
/*commandContainer*/
,
const
QVariant
&
extraData
)
{
if
(
r
.
response_code
()
!=
Response
::
RespOk
)
return
;
const
Response_DeckDownload
&
resp
=
r
.
GetExtension
(
Response_DeckDownload
::
ext
);
QString
filePath
=
extraData
.
toString
();
...
...
cockatrice/src/tab_replays.cpp
View file @
e76502cf
...
...
@@ -162,6 +162,9 @@ void TabReplays::actOpenRemoteReplay()
void
TabReplays
::
openRemoteReplayFinished
(
const
Response
&
r
)
{
if
(
r
.
response_code
()
!=
Response
::
RespOk
)
return
;
const
Response_ReplayDownload
&
resp
=
r
.
GetExtension
(
Response_ReplayDownload
::
ext
);
GameReplay
*
replay
=
new
GameReplay
;
replay
->
ParseFromString
(
resp
.
replay_data
());
...
...
@@ -197,6 +200,9 @@ void TabReplays::actDownload()
void
TabReplays
::
downloadFinished
(
const
Response
&
r
,
const
CommandContainer
&
commandContainer
,
const
QVariant
&
extraData
)
{
if
(
r
.
response_code
()
!=
Response
::
RespOk
)
return
;
const
Response_ReplayDownload
&
resp
=
r
.
GetExtension
(
Response_ReplayDownload
::
ext
);
QString
filePath
=
extraData
.
toString
();
...
...
common/pb/response.proto
View file @
e76502cf
message
Response
{
enum
ResponseCode
{
RespNotConnected
=
-
1
;
RespNothing
=
0
;
RespOk
=
1
;
RespNotInRoom
=
2
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment