/[classpath]/classpath/native/jni/java-net/javanet.c
ViewVC logotype

Diff of /classpath/native/jni/java-net/javanet.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by cbj, Thu Jan 30 06:02:21 2003 UTC revision 1.7 by cbj, Thu Jan 30 13:19:46 2003 UTC
# Line 1024  _javanet_set_option(JNIEnv *env, jobject Line 1024  _javanet_set_option(JNIEnv *env, jobject
1024                          sizeof(int));                          sizeof(int));
1025          break;          break;
1026    
1027        case SOCKOPT_SO_KEEPALIVE:
1028            mid = (*env)->GetMethodID(env, cls, "booleanValue", "()Z");
1029            if (mid == NULL)
1030              { JCL_ThrowException(env, IO_EXCEPTION,
1031                                         "Internal error: _javanet_set_option()"); return; }
1032    
1033            /* Should be a 0 or a 1 */
1034            optval = (*env)->CallBooleanMethod(env, val, mid);
1035            if ((*env)->ExceptionOccurred(env))
1036              return;
1037    
1038            rc = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void*)&optval,
1039                            sizeof(int));      
1040          break;
1041    
1042        default:        default:
1043          JCL_ThrowException(env, SOCKET_EXCEPTION, "Unrecognized option");          JCL_ThrowException(env, SOCKET_EXCEPTION, "Unrecognized option");
1044          return;          return;
# Line 1173  _javanet_get_option(JNIEnv *env, jobject Line 1188  _javanet_get_option(JNIEnv *env, jobject
1188          if (rc == -1)          if (rc == -1)
1189            {            {
1190              JCL_ThrowException(env, SOCKET_EXCEPTION, strerror(errno));              JCL_ThrowException(env, SOCKET_EXCEPTION, strerror(errno));
1191                return(0);
1192              }
1193    
1194            if (optval)
1195              return(_javanet_create_boolean(env, JNI_TRUE));
1196            else
1197              return(_javanet_create_boolean(env, JNI_FALSE));
1198    
1199            break;
1200    
1201          case SOCKOPT_SO_KEEPALIVE:
1202            optlen = sizeof(int);
1203            rc = getsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void*)&optval, &optlen);
1204            if (rc == -1)
1205              {
1206                JCL_ThrowException(env, SOCKET_EXCEPTION, strerror(errno));
1207              return(0);              return(0);
1208            }            }
1209    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26