Commit ed9ff630293438f8a68a424136929f5b2ae090a2

Authored by Georg Hopp
1 parent 473ed763

some more fixes

@@ -33,11 +33,13 @@ TR_cepWriteBuffered(TR_CommEndPoint this) @@ -33,11 +33,13 @@ TR_cepWriteBuffered(TR_CommEndPoint this)
33 33
34 switch (send) { 34 switch (send) {
35 case FALSE: // EAGAIN 35 case FALSE: // EAGAIN
  36 + TR_queuePutFirst(this->write_buffer, data);
  37 + break;
  38 +
36 case -1: // FAILURE 39 case -1: // FAILURE
37 case -2: // remote close 40 case -2: // remote close
38 - return send;  
39 -  
40 default: 41 default:
  42 + TR_delete(data);
41 break; 43 break;
42 } 44 }
43 45
@@ -122,9 +122,11 @@ TR_commManagerClose(void * _this, TR_Event event) @@ -122,9 +122,11 @@ TR_commManagerClose(void * _this, TR_Event event)
122 while (! this->endpoints[--this->max_handle]); 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 return TR_EVENT_DONE; 131 return TR_EVENT_DONE;
130 } 132 }
@@ -97,17 +97,10 @@ ioHandlerWrite(void * _this, TR_Event event) @@ -97,17 +97,10 @@ ioHandlerWrite(void * _this, TR_Event event)
97 97
98 switch (TR_cepWriteBuffered((TR_CommEndPoint)event->subject)) { 98 switch (TR_cepWriteBuffered((TR_CommEndPoint)event->subject)) {
99 case FALSE: // EAGAIN 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 break; 104 break;
112 105
113 case -1: // FAILURE 106 case -1: // FAILURE
Please register or login to post a comment