Commit b62cb1498a011357e419ec2791954c590817503b
1 parent
efc4c9ea
Exists in
master
and in
3 other branches
Debuggando uso simultâneo de várias sessões pelo mesmo aplicativo.
Showing
1 changed file
with
4 additions
and
8 deletions
Show diff stats
session.c
| @@ -97,13 +97,13 @@ void lib3270_session_free(H3270 *h) | @@ -97,13 +97,13 @@ void lib3270_session_free(H3270 *h) | ||
| 97 | if(h == default_session) | 97 | if(h == default_session) |
| 98 | default_session = NULL; | 98 | default_session = NULL; |
| 99 | 99 | ||
| 100 | - | ||
| 101 | // Release hostname info | 100 | // Release hostname info |
| 102 | release_pointer(h->host.current); | 101 | release_pointer(h->host.current); |
| 103 | release_pointer(h->host.full); | 102 | release_pointer(h->host.full); |
| 104 | release_pointer(h->host.srvc); | 103 | release_pointer(h->host.srvc); |
| 105 | release_pointer(h->host.qualified); | 104 | release_pointer(h->host.qualified); |
| 106 | 105 | ||
| 106 | + trace("Releasing session %p",h); | ||
| 107 | lib3270_free(h); | 107 | lib3270_free(h); |
| 108 | 108 | ||
| 109 | } | 109 | } |
| @@ -258,14 +258,10 @@ H3270 * lib3270_session_new(const char *model) | @@ -258,14 +258,10 @@ H3270 * lib3270_session_new(const char *model) | ||
| 258 | 258 | ||
| 259 | trace("%s - configured=%s",__FUNCTION__,default_session ? "Yes" : "No"); | 259 | trace("%s - configured=%s",__FUNCTION__,default_session ? "Yes" : "No"); |
| 260 | 260 | ||
| 261 | - if(default_session) | ||
| 262 | - { | ||
| 263 | - // TODO (perry#5#): Allocate a new structure. | ||
| 264 | - errno = EBUSY; | ||
| 265 | - return lib3270_get_default_session_handle(); | ||
| 266 | - } | 261 | + hSession = lib3270_malloc(sizeof(H3270)); |
| 267 | 262 | ||
| 268 | - hSession = default_session = lib3270_malloc(sizeof(H3270)); | 263 | + if(!default_session) |
| 264 | + default_session = hSession; | ||
| 269 | 265 | ||
| 270 | lib3270_session_init(hSession, model, _( "bracket" ) ); | 266 | lib3270_session_init(hSession, model, _( "bracket" ) ); |
| 271 | 267 |