Changeset 5396:e2e5f307ef8b in roaraudio
- Timestamp:
- 01/24/12 01:22:31 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- libroar
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/vio_proto.c
r5381 r5396 46 46 char * ed; 47 47 char * tmp; 48 int flags = ROAR_VIOF_READWRITE; 48 49 49 50 if ( def == NULL ) … … 61 62 dstr = "//"; 62 63 63 if ( roar_vio_dstr_init_defaults(def, ROAR_VIO_DEF_TYPE_SOCKET, O_RDWR, 0644) == -1 ) 64 if ( odef->o_flags & ROAR_VIOF_NONBLOCK ) 65 flags |= ROAR_VIOF_NONBLOCK; 66 67 if ( roar_vio_dstr_init_defaults(def, ROAR_VIO_DEF_TYPE_SOCKET, flags, 0644) == -1 ) 64 68 return -1; 65 69 … … 100 104 const char * host; 101 105 char * tmp; 106 int ret; 102 107 103 108 ROAR_DBG("roar_vio_open_proto(calls=%p, dst=%p, dstr='%s', proto=%i, odef=%p) = ?", calls, dst, dstr, proto, odef); … … 169 174 self->proto = proto; 170 175 176 if ( odef->o_flags & ROAR_VIOF_NONBLOCK ) { 177 if ( roar_vio_nonblock(calls, ROAR_SOCKET_BLOCK) == -1 ) { 178 return -1; 179 } 180 } 171 181 switch (proto) { 172 182 case ROAR_VIO_PROTO_P_HTTP: 173 183 case ROAR_VIO_PROTO_P_ICY: 174 ret urnroar_vio_open_proto_http(calls, dst, host, dstr, userpass.user != NULL ? &userpass : NULL);184 ret = roar_vio_open_proto_http(calls, dst, host, dstr, userpass.user != NULL ? &userpass : NULL); 175 185 break; 176 186 case ROAR_VIO_PROTO_P_GOPHER: 177 return roar_vio_open_proto_gopher(calls, dst, host, dstr); 178 break; 179 } 180 181 ROAR_DBG("roar_vio_open_proto(*) = -1 // no matching protocol"); 182 return -1; 187 ret = roar_vio_open_proto_gopher(calls, dst, host, dstr); 188 break; 189 default: 190 ROAR_DBG("roar_vio_open_proto(*) = -1 // no matching protocol"); 191 roar_err_set(ROAR_ERROR_NOTSUP); 192 ret = -1; 193 break; 194 } 195 if ( odef->o_flags & ROAR_VIOF_NONBLOCK ) { 196 if ( roar_vio_nonblock(calls, ROAR_SOCKET_NONBLOCK) == -1 ) { 197 return -1; 198 } 199 } 200 201 return ret; 183 202 #else 184 203 return -1; … … 497 516 ROAR_DBG("roar_vio_open_proto_http(calls=%p, dst=%p, host='%s', file='%s') = ?", calls, dst, host, file); 498 517 499 roar_vio_printf(dst, "GET /%s HTTP/1.1\r\n", file); 518 if ( roar_vio_printf(dst, "GET /%s HTTP/1.1\r\n", file) == -1 ) 519 return -1; 520 500 521 roar_vio_printf(dst, "Host: %s\r\n", host); 501 522 roar_vio_printf(dst, "User-Agent: roar_vio_open_proto_http() $Revision$\r\n"); -
libroar/vio_socket.c
r5381 r5396 171 171 } 172 172 } else { 173 if ( def->o_flags & ROAR_VIOF_NONBLOCK ) { 174 if ( roar_socket_nonblock(fh, ROAR_SOCKET_NONBLOCK) == -1 ) { 175 close(fh); 176 return -1; 177 } 178 } 179 173 180 if ( connect(fh, &(def->d.socket.sa.sa), len) == -1 ) { 174 close(fh); 175 return -1; 181 if ( errno != EINPROGRESS ) { 182 roar_err_from_errno(); 183 close(fh); 184 return -1; 185 } 176 186 } 177 187 }
Note: See TracChangeset
for help on using the changeset viewer.