Showing
3 changed files
with
17 additions
and
3 deletions
... | ... | @@ -55,10 +55,11 @@ datagramServiceNextMessage(void * _this, TR_RemoteData * data) |
55 | 55 | { |
56 | 56 | TR_CommEndPoint comm = _this; |
57 | 57 | TR_ProtoMessage ret_message = NULL; |
58 | + TR_RemoteData new_data = NULL; | |
58 | 59 | |
59 | 60 | if (*data) { |
60 | 61 | ret_message = TR_protoCreateMessage(comm->protocol, (*data)->remote); |
61 | - TR_protoParse(comm->protocol, ret_message, *data); | |
62 | + new_data = TR_protoParse(comm->protocol, ret_message, *data); | |
62 | 63 | |
63 | 64 | /* |
64 | 65 | * In UDP I don't care about remaining data. UDP is an all or nothing |
... | ... | @@ -71,8 +72,11 @@ datagramServiceNextMessage(void * _this, TR_RemoteData * data) |
71 | 72 | */ |
72 | 73 | |
73 | 74 | if (! ret_message->ready) { |
74 | - TR_delete(*data); | |
75 | 75 | TR_delete(ret_message); |
76 | + if (new_data) { | |
77 | + TR_delete(new_data); | |
78 | + TR_delete(*data); | |
79 | + } | |
76 | 80 | } |
77 | 81 | |
78 | 82 | *data = NULL; |
... | ... | @@ -88,6 +92,10 @@ datagramServiceCompose(void * _this, TR_ProtoMessage message) |
88 | 92 | TR_RemoteData data = |
89 | 93 | TR_protoCompose(((TR_CommEndPoint)_this)->protocol, message); |
90 | 94 | |
95 | + if (data->remote->handle == -1) { | |
96 | + data->free_remote = 1; | |
97 | + } | |
98 | + | |
91 | 99 | if (! data) { |
92 | 100 | return FALSE; |
93 | 101 | } | ... | ... |
... | ... | @@ -126,6 +126,12 @@ static |
126 | 126 | TR_EventDone |
127 | 127 | simpleClientHandleData(void * _this, TR_Event event) |
128 | 128 | { |
129 | + TR_ProtoMessage data = event->data; | |
130 | + | |
131 | + if (data->remote->handle == -1) { | |
132 | + TR_delete(data->remote); | |
133 | + } | |
134 | + | |
129 | 135 | ((TR_SimpleClient)_this)->response = event->data; |
130 | 136 | |
131 | 137 | return TR_EVENT_DONE; | ... | ... |
Please
register
or
login
to post a comment