Commit f4f8ac5d9a8fbc40328381f591c515712fa9dc3a

Authored by Georg Hopp
1 parent 010e977b

some small fixes

@@ -29,7 +29,7 @@ int @@ -29,7 +29,7 @@ int
29 TR_cepWriteBuffered(TR_CommEndPoint this, size_t * size) 29 TR_cepWriteBuffered(TR_CommEndPoint this, size_t * size)
30 { 30 {
31 TR_RemoteData data; 31 TR_RemoteData data;
32 - int send; 32 + int send = -4;
33 33
34 *size = 0; 34 *size = 0;
35 35
@@ -55,10 +55,11 @@ datagramServiceNextMessage(void * _this, TR_RemoteData * data) @@ -55,10 +55,11 @@ datagramServiceNextMessage(void * _this, TR_RemoteData * data)
55 { 55 {
56 TR_CommEndPoint comm = _this; 56 TR_CommEndPoint comm = _this;
57 TR_ProtoMessage ret_message = NULL; 57 TR_ProtoMessage ret_message = NULL;
  58 + TR_RemoteData new_data = NULL;
58 59
59 if (*data) { 60 if (*data) {
60 ret_message = TR_protoCreateMessage(comm->protocol, (*data)->remote); 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 * In UDP I don't care about remaining data. UDP is an all or nothing 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,8 +72,11 @@ datagramServiceNextMessage(void * _this, TR_RemoteData * data)
71 */ 72 */
72 73
73 if (! ret_message->ready) { 74 if (! ret_message->ready) {
74 - TR_delete(*data);  
75 TR_delete(ret_message); 75 TR_delete(ret_message);
  76 + if (new_data) {
  77 + TR_delete(new_data);
  78 + TR_delete(*data);
  79 + }
76 } 80 }
77 81
78 *data = NULL; 82 *data = NULL;
@@ -88,6 +92,10 @@ datagramServiceCompose(void * _this, TR_ProtoMessage message) @@ -88,6 +92,10 @@ datagramServiceCompose(void * _this, TR_ProtoMessage message)
88 TR_RemoteData data = 92 TR_RemoteData data =
89 TR_protoCompose(((TR_CommEndPoint)_this)->protocol, message); 93 TR_protoCompose(((TR_CommEndPoint)_this)->protocol, message);
90 94
  95 + if (data->remote->handle == -1) {
  96 + data->free_remote = 1;
  97 + }
  98 +
91 if (! data) { 99 if (! data) {
92 return FALSE; 100 return FALSE;
93 } 101 }
@@ -126,6 +126,12 @@ static @@ -126,6 +126,12 @@ static
126 TR_EventDone 126 TR_EventDone
127 simpleClientHandleData(void * _this, TR_Event event) 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 ((TR_SimpleClient)_this)->response = event->data; 135 ((TR_SimpleClient)_this)->response = event->data;
130 136
131 return TR_EVENT_DONE; 137 return TR_EVENT_DONE;
Please register or login to post a comment