Showing
3 changed files
with
13 additions
and
16 deletions
... | ... | @@ -33,11 +33,13 @@ TR_cepWriteBuffered(TR_CommEndPoint this) |
33 | 33 | |
34 | 34 | switch (send) { |
35 | 35 | case FALSE: // EAGAIN |
36 | + TR_queuePutFirst(this->write_buffer, data); | |
37 | + break; | |
38 | + | |
36 | 39 | case -1: // FAILURE |
37 | 40 | case -2: // remote close |
38 | - return send; | |
39 | - | |
40 | 41 | default: |
42 | + TR_delete(data); | |
41 | 43 | break; |
42 | 44 | } |
43 | 45 | ... | ... |
... | ... | @@ -122,9 +122,11 @@ TR_commManagerClose(void * _this, TR_Event event) |
122 | 122 | while (! this->endpoints[--this->max_handle]); |
123 | 123 | } |
124 | 124 | |
125 | - TR_eventSubjectFinalize( | |
126 | - (TR_EventSubject)this->endpoints[endpoint->transport->handle]); | |
127 | - this->endpoints[endpoint->transport->handle] = NULL; | |
125 | + if (this->endpoints[endpoint->transport->handle]) { | |
126 | + TR_eventSubjectFinalize( | |
127 | + (TR_EventSubject)this->endpoints[endpoint->transport->handle]); | |
128 | + this->endpoints[endpoint->transport->handle] = NULL; | |
129 | + } | |
128 | 130 | |
129 | 131 | return TR_EVENT_DONE; |
130 | 132 | } | ... | ... |
... | ... | @@ -97,17 +97,10 @@ ioHandlerWrite(void * _this, TR_Event event) |
97 | 97 | |
98 | 98 | switch (TR_cepWriteBuffered((TR_CommEndPoint)event->subject)) { |
99 | 99 | case FALSE: // EAGAIN |
100 | - if (TR_cepHasPendingData((TR_CommEndPoint)event->subject)) { | |
101 | - revent = TR_eventSubjectEmit( | |
102 | - event->subject, | |
103 | - TR_CEP_EVENT_PENDING_DATA, | |
104 | - NULL); | |
105 | - } else { | |
106 | - revent = TR_eventSubjectEmit( | |
107 | - event->subject, | |
108 | - TR_CEP_EVENT_END_DATA, | |
109 | - NULL); | |
110 | - } | |
100 | + revent = TR_eventSubjectEmit( | |
101 | + event->subject, | |
102 | + TR_CEP_EVENT_PENDING_DATA, | |
103 | + NULL); | |
111 | 104 | break; |
112 | 105 | |
113 | 106 | case -1: // FAILURE | ... | ... |
Please
register
or
login
to post a comment