Changeset 5739:2a1671d592b9 in roaraudio for plugins/roard/protocol-gopher.c
- Timestamp:
- 11/09/12 01:09:22 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/roard/protocol-gopher.c
r5640 r5739 631 631 } 632 632 633 int emul_gopher_check_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {633 static int emul_gopher_check_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) { 634 634 struct roar_client_server * cs; 635 struct roar_vio_calls rvio;636 635 struct item * c = NULL; 637 636 char inbuf[1024]; … … 646 645 647 646 if ( clients_get_server(client, &cs) == -1 ) { 648 clients_delete(client);649 647 return -1; 650 648 } 651 649 652 650 ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio); 653 654 if ( vio == NULL ) {655 vio = &rvio;656 roar_vio_open_fh_socket(vio, clients_get_fh(client));657 }658 651 659 652 ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio); … … 662 655 len = sizeof(inbuf)-1; 663 656 if ( roar_buffer_shift_out(&(cs->inbuf), inbuf, &len) == -1 ) { 664 clients_delete(client);665 657 return -1; 666 658 } … … 668 660 if ( cs->inbuf != NULL ) { 669 661 roar_buffer_free(cs->inbuf); 670 clients_delete(client);671 662 return -1; 672 663 } … … 674 665 // test if we have still buffer space left. 675 666 if ( len == (sizeof(inbuf)-1) ) { 676 clients_delete(client);677 667 return -1; 678 668 } … … 683 673 ret = roar_vio_read(vio, inbuf+len, sizeof(inbuf)-len-1); 684 674 if ( ret < 1 ) { 685 clients_delete(client);686 675 ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio); 687 676 return -1; … … 696 685 if ( !strip_nl(inbuf) ) { 697 686 if ( roar_buffer_new_data(&(cs->inbuf), ret, &data) == -1 ) { 698 clients_delete(client);699 687 ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio); 700 688 return -1; … … 719 707 720 708 if ( c == NULL ) { 721 clients_delete(client);722 709 ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio); 723 710 return -1; … … 752 739 753 740 if ( funcret == -1 ) { 754 clients_delete(client);755 741 ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = -1", client, vio); 756 742 return -1; … … 762 748 } 763 749 764 int emul_gopher_flushed_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {750 static int emul_gopher_flushed_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) { 765 751 ROAR_DBG("emul_gopher_flushed_client(client=%i, vio=%p) = ?", client, vio); 766 752 767 return clients_delete(client); 768 } 753 return -1; 754 } 755 756 struct roar_dl_proto __proto_common_gopher = { 757 .proto = ROAR_PROTO_GOPHER, 758 .description = "The Internet Gopher Protocol", 759 .flags = ROAR_DL_PROTO_FLAGS_NONE, 760 .handle = emul_gopher_check_client, 761 .flushed = emul_gopher_flushed_client 762 }; 769 763 770 764 #endif
Note: See TracChangeset
for help on using the changeset viewer.