| 339 | } |
| 340 | |
| 341 | S32 handleNativeSocketError(const std::shared_ptr<KNativeSocketObject>& s, bool write) { |
| 342 | #ifdef WIN32 |
| 343 | S32 result = translateNativeSocketError(s, WSAGetLastError()); |
| 344 | #else |
| 345 | S32 result = translateNativeSocketError(s, errno); |
| 346 | #endif |
| 347 | s->error = -result; |
| 348 | #ifndef BOXEDWINE_MULTI_THREADED |
| 349 | if (result == -K_EWOULDBLOCK) { |
| 350 | addWaitingNativeSocket(s); |
| 351 | if (s->blocking) { |
| 352 | if (write) { |
| 353 | BOXEDWINE_CONDITION_LOCK(s->writingCond); |
| 354 | BOXEDWINE_CONDITION_WAIT(s->writingCond); |
| 355 | BOXEDWINE_CONDITION_UNLOCK(s->writingCond); |
| 356 | } else { |
| 357 | BOXEDWINE_CONDITION_LOCK(s->readingCond); |
| 358 | BOXEDWINE_CONDITION_WAIT(s->readingCond); |
| 359 | BOXEDWINE_CONDITION_UNLOCK(s->readingCond); |
| 360 | } |
| 361 | } |
| 362 | } |
| 363 | #endif |
| 364 | return result; |
| 365 | } |
| 366 | |
| 367 | KNativeSocketObject::KNativeSocketObject(U32 domain, U32 type, U32 protocol) : KSocketObject(KTYPE_NATIVE_SOCKET, domain, type, protocol), |
| 368 | connecting(false), |
no test coverage detected