Home | History | Annotate | Download | only in android

Lines Matching refs:ssocket

102 syncsocket_close(SyncSocket* ssocket)
104 if (ssocket != NULL && ssocket->fd >= 0) {
105 if (ssocket->iolooper != NULL) {
106 iolooper_reset(ssocket->iolooper);
108 socket_close(ssocket->fd);
109 ssocket->fd = -1;
114 syncsocket_free(SyncSocket* ssocket)
116 if (ssocket != NULL) {
117 if (ssocket->iolooper != NULL) {
118 iolooper_free(ssocket->iolooper);
120 free(ssocket);
125 syncsocket_start_read(SyncSocket* ssocket)
127 if (ssocket == NULL || ssocket->fd < 0 || ssocket->iolooper == NULL) {
131 iolooper_add_read(ssocket->iolooper, ssocket->fd);
136 syncsocket_stop_read(SyncSocket* ssocket)
138 if (ssocket == NULL || ssocket->fd < 0 || ssocket->iolooper == NULL) {
142 iolooper_del_read(ssocket->iolooper, ssocket->fd);
147 syncsocket_start_write(SyncSocket* ssocket)
149 if (ssocket == NULL || ssocket->fd < 0 || ssocket->iolooper == NULL) {
153 iolooper_add_write(ssocket->iolooper, ssocket->fd);
158 syncsocket_stop_write(SyncSocket* ssocket)
160 if (ssocket == NULL || ssocket->fd < 0 || ssocket->iolooper == NULL) {
164 iolooper_del_write(ssocket->iolooper, ssocket->fd);
169 syncsocket_read_absolute(SyncSocket* ssocket,
176 if (ssocket == NULL || ssocket->fd < 0 || ssocket->iolooper == NULL) {
181 ret = iolooper_wait_absolute(ssocket->iolooper, deadline);
183 if (!iolooper_is_read(ssocket->iolooper, ssocket->fd)) {
188 ret = socket_recv(ssocket->fd, buf, size);
199 syncsocket_read(SyncSocket* ssocket, void* buf, size_t size, int timeout)
201 return syncsocket_read_absolute(ssocket, buf, size, iolooper_now() + timeout);
205 syncsocket_write_absolute(SyncSocket* ssocket,
213 if (ssocket == NULL || ssocket->fd < 0 || ssocket->iolooper == NULL) {
219 ret = iolooper_wait_absolute(ssocket->iolooper, deadline);
227 if (!iolooper_is_write(ssocket->iolooper, ssocket->fd)) {
233 ret = socket_send(ssocket->fd, (const char*)buf + written, size - written);
252 syncsocket_write(SyncSocket* ssocket, const void* buf, size_t size, int timeout)
254 return syncsocket_write_absolute(ssocket, buf, size, iolooper_now() + timeout);
258 syncsocket_read_line_absolute(SyncSocket* ssocket,
267 int ret = syncsocket_read_absolute(ssocket, &ch, 1, deadline);
283 syncsocket_read_line(SyncSocket* ssocket, char* buffer, size_t size, int timeout)
285 return syncsocket_read_line_absolute(ssocket, buffer, size,
290 syncsocket_get_socket(SyncSocket* ssocket)
292 return (ssocket != NULL) ? ssocket->fd : -1;