| 133 | } |
| 134 | |
| 135 | int LocalSocket::ConnectTo(Socket* client){ |
| 136 | assert(passive); |
| 137 | |
| 138 | pendingConnections.Wait(); |
| 139 | |
| 140 | pending.add_back(client); |
| 141 | |
| 142 | acquireLock(&watcherLock); |
| 143 | while(watching.get_length()){ |
| 144 | watching.remove_at(0)->Signal(); |
| 145 | } |
| 146 | releaseLock(&watcherLock); |
| 147 | |
| 148 | while(!client->connected){ |
| 149 | // TODO: Actually block the task |
| 150 | Scheduler::Yield(); |
| 151 | } |
| 152 | |
| 153 | pendingConnections.Signal(); |
| 154 | |
| 155 | return 0; |
| 156 | } |
| 157 | |
| 158 | void LocalSocket::DisconnectPeer(){ |
| 159 | assert(peer); |