Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
26590f4f
Commit
26590f4f
authored
16 years ago
by
edgrif
Browse files
Options
Downloads
Patches
Plain Diff
clean up handling of when a server dies during feature loading.
parent
a81649e4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/zmapView/zmapView.c
+45
-51
45 additions, 51 deletions
src/zmapView/zmapView.c
with
45 additions
and
51 deletions
src/zmapView/zmapView.c
+
45
−
51
View file @
26590f4f
...
...
@@ -27,9 +27,9 @@
*
* Exported functions: See ZMap/zmapView.h
* HISTORY:
* Last edited:
Feb 12 19:31
2009 (
rds
)
* Last edited:
Mar 20 12:44
2009 (
edgrif
)
* Created: Thu May 13 15:28:26 2004 (edgrif)
* CVS info: $Id: zmapView.c,v 1.15
2
2009-0
2-13 10:24:00 rds
Exp $
* CVS info: $Id: zmapView.c,v 1.15
3
2009-0
3-20 12:44:49 edgrif
Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -177,7 +177,7 @@ static void threadDebugMsg(ZMapThread thread, char *format_str, char *msg) ;
static
void
killAllSpawned
(
ZMapView
zmap_view
);
static
gboolean
c
onnections
(
ZMapView
zmap_view
,
gboolean
threads_have_died
)
;
static
gboolean
c
heckContinue
(
ZMapView
zmap_view
)
;
static
gboolean
makeStylesDrawable
(
GData
*
styles
,
char
**
missing_styles_out
)
;
...
...
@@ -1863,13 +1863,6 @@ static gboolean checkStateConnections(ZMapView zmap_view)
threadDebugMsg
(
thread
,
"GUI: thread %s has died so cleaning up....
\n
"
,
NULL
)
;
/* We are going to remove an item from the list so better move on from
* this item. */
list_item
=
g_list_next
(
list_item
)
;
zmap_view
->
connection_list
=
g_list_remove
(
zmap_view
->
connection_list
,
view_con
)
;
destroyConnection
(
&
view_con
)
;
break
;
}
case
ZMAPTHREAD_REPLY_CANCELLED
:
...
...
@@ -1881,13 +1874,6 @@ static gboolean checkStateConnections(ZMapView zmap_view)
/* This means the thread was cancelled so we should clean up..... */
threadDebugMsg
(
thread
,
"GUI: thread %s has been cancelled so cleaning up....
\n
"
,
NULL
)
;
/* We are going to remove an item from the list so better move on from
* this item. */
list_item
=
g_list_next
(
list_item
)
;
zmap_view
->
connection_list
=
g_list_remove
(
zmap_view
->
connection_list
,
view_con
)
;
destroyConnection
(
&
view_con
)
;
break
;
}
default:
...
...
@@ -1897,6 +1883,21 @@ static gboolean checkStateConnections(ZMapView zmap_view)
break
;
}
}
/* If the thread has died then remove it's connection. */
if
(
threads_have_died
)
{
/* We are going to remove an item from the list so better move on from
* this item. */
list_item
=
g_list_next
(
list_item
)
;
zmap_view
->
connection_list
=
g_list_remove
(
zmap_view
->
connection_list
,
view_con
)
;
/* If step list is unfinished then remove failed connection from it. */
if
(
zmap_view
->
step_list
)
zmapViewStepListStepConnectionDeleteAll
(
zmap_view
->
step_list
,
view_con
)
;
destroyConnection
(
&
view_con
)
;
}
}
}
while
((
list_item
=
g_list_next
(
list_item
)))
;
...
...
@@ -1910,18 +1911,6 @@ static gboolean checkStateConnections(ZMapView zmap_view)
zmapViewBusy
(
zmap_view
,
FALSE
)
;
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
if
(
reply
==
ZMAPTHREAD_REPLY_REQERROR
&&
zmap_view
->
on_fail
==
REQUEST_ONFAIL_CANCEL_REQUEST
)
{
zmapViewStepListDestroy
(
zmap_view
->
step_list
)
;
zmap_view
->
step_list
=
NULL
;
}
#endif
/* ED_G_NEVER_INCLUDE_THIS_CODE */
/* At this point if we have connections then we carry on looping looking for
* replies from the views. If there are no threads left then we need to examine
* our state and take action depending on whether we are dying or threads
...
...
@@ -1951,7 +1940,7 @@ static gboolean checkStateConnections(ZMapView zmap_view)
else
{
/* Decide if we need to be called again or if everythings dead. */
call_again
=
c
onnections
(
zmap_view
,
threads_have_died
)
;
call_again
=
c
heckContinue
(
zmap_view
)
;
}
...
...
@@ -2340,7 +2329,8 @@ static ZMapViewConnection createConnection(ZMapView zmap_view,
/* Create the thread to service the connection requests, we give it a function that it will call
* to decode the requests we send it and a terminate function. */
if
(
status
&&
(
thread
=
zMapThreadCreate
(
zMapServerRequestHandler
,
zMapServerTerminateHandler
)))
if
(
status
&&
(
thread
=
zMapThreadCreate
(
zMapServerRequestHandler
,
zMapServerTerminateHandler
,
zMapServerDestroyHandler
)))
{
ZMapViewConnectionRequest
request
;
ZMapFeatureContext
context
;
...
...
@@ -3184,7 +3174,7 @@ static void threadDebugMsg(ZMapThread thread, char *format_str, char *msg)
/* check whether there are live connections or not, return TRUE if there are, FALSE otherwise. */
static
gboolean
c
onnections
(
ZMapView
zmap_view
,
gboolean
threads_have_died
)
static
gboolean
c
heckContinue
(
ZMapView
zmap_view
)
{
gboolean
connections
=
FALSE
;
...
...
@@ -3201,31 +3191,35 @@ static gboolean connections(ZMapView zmap_view, gboolean threads_have_died)
case
ZMAPVIEW_LOADING
:
case
ZMAPVIEW_LOADED
:
{
/* We should kill the ZMap here with an error message....or allow user to reload... */
/* Kill the view as all connections have died. */
/* Threads have died because of their own errors....but the ZMap is not dying so
* reset state to init and we should return an error here....(but how ?), we
* should not be outputting messages....I think..... */
/* need to reset here..... */
if
(
threads_have_died
)
{
/* Threads have died because of their own errors....but the ZMap is not dying so
* reset state to init and we should return an error here....(but how ?), we
* should not be outputting messages....I think..... */
zMapWarning
(
"%s"
,
"Cannot show ZMap because server connections have all died or been cancelled."
)
;
zMapLogWarning
(
"%s"
,
"Cannot show ZMap because server connections have all died or been cancelled."
)
;
/* Tricky coding here: we need to destroy the view _before_ we notify the layer above us
* that the zmap_view has gone but we need to pass information from the view back, so we
* keep a temporary record of certain parts of the view. */
ZMapView
zmap_view_ref
=
zmap_view
;
void
*
app_data
=
zmap_view
->
app_data
;
ZMapViewCallbackDestroyData
destroy_data
;
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
/* Should we kill the whole window ??? */
zMapWarning
(
"%s"
,
"Cannot show ZMap because server connections have all died or been cancelled."
)
;
zMapLogWarning
(
"%s"
,
"Cannot show ZMap because server connections have all died or been cancelled."
)
;
killGUI
(
zmap_view
)
;
destroyZMapView
(
zmap_view
)
;
#endif
/* ED_G_NEVER_INCLUDE_THIS_CODE */
/* need to reset here..... */
zmap_view
->
state
=
ZMAPVIEW_DYING
;
killGUI
(
zmap_view
)
;
connections
=
FALSE
;
}
/* I don't think the "else" should be possible......so perhaps we should fail if that
* happens..... */
destroy_data
=
g_new
(
ZMapViewCallbackDestroyDataStruct
,
1
)
;
/* Caller must free. */
destroy_data
->
xwid
=
zmap_view
->
xwid
;
zmap_view
->
state
=
ZMAPVIEW_INIT
;
destroyZMapView
(
&
zmap_view
)
;
/* Signal layer above us that view has died. */
(
*
(
view_cbs_G
->
destroy
))(
zmap_view_ref
,
app_data
,
destroy_data
)
;
connections
=
FALSE
;
break
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment