Commit 651fae76 authored by 's avatar

Increase a buffer size

git-svn-id: file:///home/svn/mapi/trunk@474 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 94b6ed1b
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* memset */
#include <unistd.h> /* close, read, write */
#include <ctype.h> /* toupper */
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <pthread.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h> /* for sockaddr_in and inet_ntoa() */
#include <arpa/inet.h>
#include <sys/time.h>
#include "mapi.h"
#include "mapiipc.h"
......@@ -126,7 +126,7 @@ void *handle_request(void *arg) {
int sock;
int recv_bytes;
char buffer[MAX_SEND_SIZE];
char buffer[DIMAPI_DATA_SIZE];
struct dmapiipcbuf *dbuf=NULL;
int mapid_result;
void *result;
......@@ -155,7 +155,7 @@ void *handle_request(void *arg) {
if (dbuf_bytes==0 || dbuf_bytes<((struct dmapiipcbuf *)buffer)->length){
recv_bytes = recv(sock, (char*)buffer+dbuf_bytes, MAX_SEND_SIZE, 0);
recv_bytes = recv(sock, (char*)buffer+dbuf_bytes, DIMAPI_DATA_SIZE, 0);
if (recv_bytes == 0) { /* the peer has gone */
printf("Peer has gone\n");
......@@ -224,7 +224,7 @@ void *handle_request(void *arg) {
dbuf->length = BASIC_SIZE;
break;
case APPLY_FUNCTION:
fprintf(stdout,"APPLY_FUNCTION: ");
fprintf(stdout,"APPLY_FUNCTION\n");
if((( dbuf->fid = getfid(dbuf))!=-1)){
dbuf->cmd = APPLY_FUNCTION_ACK;
}
......
......@@ -25,8 +25,8 @@ int main(MAPI_UNUSED int argc, char *argv[])
fd=mapi_create_flow(argv[1]);
fid=mapi_apply_function(fd,"TOP",10,TOPX_TCP,TOPX_TCP_DSTPORT);
fid=mapi_apply_function(fd,"TOP",10,TOPX_TCP,TOPX_TCP_DSTPORT,100);
mapi_connect(fd);
while (1)
......
......@@ -108,7 +108,7 @@ struct mapipkt {
#ifdef DIMAPI
#define HOST_DEV_SIZE 256
#define MAX_RESULT_SZ 1000
#define MAX_RESULT_SZ 50000
//struct returned by read_results in dimapi
struct dmapi_results {
unsigned char first_res[MAX_RESULT_SZ]; //only for compatibility reasons
......
......@@ -124,7 +124,7 @@ void mapiipc_remote_write_to_all(remote_flowdescr_t* rflow)
void *mapiipc_comm_thread(void *host) {
//Reads an IPC message. Blocking call
char buffer[MAX_SEND_SIZE];
char buffer[DIMAPI_DATA_SIZE];
struct dmapiipcbuf* dbuf;
remote_flowdescr_t* rflow;
host_flow* hflow;
......@@ -137,7 +137,7 @@ void *mapiipc_comm_thread(void *host) {
while (1) {
if (dbuf_bytes==0 || dbuf_bytes<dbuf->length) {
if( (recv_bytes=recv(((struct host *)host)->sockfd, (char*)&buffer+dbuf_bytes, MAX_SEND_SIZE, 0)) == -1) {
if( (recv_bytes=recv(((struct host *)host)->sockfd, (char*)&buffer+dbuf_bytes, DIMAPI_DATA_SIZE, 0)) == -1) {
//ERROR_CMD(printf("recv: %s [%s:%d]\n",strerror(errno),__FILE__,__LINE__));
exit(1);
//printf("error 1\n");
......
......@@ -143,7 +143,7 @@ struct dmapiipcbuf {
char data[DIMAPI_DATA_SIZE];
};
#define BASIC_SIZE (sizeof(struct dmapiipcbuf) - DATA_SIZE)
#define BASIC_SIZE (sizeof(struct dmapiipcbuf) - DIMAPI_DATA_SIZE)
#define PKT_LENGTH 1600 //pkt info and actual pkt
typedef struct host_flow {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment